feat(core): 设置系统代理时同时设置环境变量 #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [ windows ] | |
goarch: [ amd64, arm64 ] | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Get short commit SHA | |
id: commit-sha | |
run: echo "COMMIT_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Build for ${{ matrix.goos }}/${{ matrix.goarch }} | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
CGO_ENABLED: 0 | |
LDFLAGS: '-s -w -X main.build=${{ env.COMMIT_SHA_SHORT }} -H=windowsgui' | |
run: | | |
mkdir -p bin | |
go version | |
go build -ldflags="${{ env.LDFLAGS }}" -trimpath -o bin/gohomo.exe . | |
cd bin | |
zip -r gohomo-${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.COMMIT_SHA_SHORT }}.zip * | |
cd .. | |
echo -n "${{ env.COMMIT_SHA_SHORT }}" > bin/version.txt | |
- name: Upload release assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
bin/*.zip | |
bin/version.txt | |
draft: false | |
prerelease: false | |
make_latest: true |