File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 branches :
66 - " **"
77
8+ permissions :
9+ contents : write
10+
811jobs :
912 build-release :
1013 if : contains(github.event.head_commit.message, 'stable release')
1114 runs-on : ubuntu-latest
12- strategy :
13- matrix :
14- include :
15- - goos : linux
16- goarch : amd64
17- - goos : linux
18- goarch : arm64
19- - goos : darwin
20- goarch : amd64
21- - goos : darwin
22- goarch : arm64
23- - goos : windows
24- goarch : amd64
25- - goos : windows
26- goarch : arm64
27- - goos : freebsd
28- goarch : amd64
29- - goos : freebsd
30- goarch : arm64
31- - goos : openbsd
32- goarch : amd64
33- - goos : openbsd
34- goarch : arm64
3515 steps :
3616 - name : Checkout
3717 run : |
@@ -51,27 +31,24 @@ jobs:
5131 run : |
5232 mkdir -p dist
5333 export CGO_ENABLED=0
54- export GOOS=${{ matrix.goos }}
55- export GOARCH=${{ matrix.goarch }}
56- output="chicha-ip-proxy_${GOOS}_${GOARCH}"
57- if [ "$GOOS" = "windows" ]; then
58- output="${output}.exe"
59- fi
60- /usr/local/go/bin/go build -trimpath -ldflags="-s -w" -o "dist/${output}" .
61- tar -czf "dist/${output}.tar.gz" -C dist "${output}"
34+ targets="linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64 freebsd/amd64 freebsd/arm64 openbsd/amd64 openbsd/arm64"
35+ for target in $targets; do
36+ GOOS="${target%/*}"
37+ GOARCH="${target#*/}"
38+ output="chicha-ip-proxy_${GOOS}_${GOARCH}"
39+ if [ "$GOOS" = "windows" ]; then
40+ output="${output}.exe"
41+ fi
42+ GOOS="$GOOS" GOARCH="$GOARCH" /usr/local/go/bin/go build -trimpath -ldflags="-s -w" -o "dist/${output}" .
43+ tar -czf "dist/${output}.tar.gz" -C dist "${output}"
44+ done
6245
6346 - name : Publish release
6447 env :
6548 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6649 run : |
6750 tag="stable-${{ github.sha }}"
6851 if ! gh release view "$tag" >/dev/null 2>&1; then
69- gh release create "$tag" --title "$tag" --notes "Automated stable release for ${{ github.sha }}." || true
52+ gh release create "$tag" --title "$tag" --notes "Automated stable release for ${{ github.sha }}."
7053 fi
71- for i in 1 2 3 4 5; do
72- if gh release view "$tag" >/dev/null 2>&1; then
73- break
74- fi
75- sleep 2
76- done
7754 gh release upload "$tag" dist/*.tar.gz --clobber
You can’t perform that action at this time.
0 commit comments