44 pull_request :
55 push :
66 branches :
7- - main
87 - master
98 tags :
109 - " v*"
@@ -30,10 +29,15 @@ jobs:
3029
3130 - name : Cross-compile binaries
3231 run : |
32+ set -euo pipefail
3333 mkdir -p dist
34- for GOOS in linux darwin; do
34+ for GOOS in linux darwin windows ; do
3535 for GOARCH in amd64 arm64; do
36- bin="dist/drawbridge-${GOOS}-${GOARCH}"
36+ ext=""
37+ if [ "$GOOS" = "windows" ]; then
38+ ext=".exe"
39+ fi
40+ bin="dist/drawbridge-${GOOS}-${GOARCH}${ext}"
3741 GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -o "$bin" .
3842 done
3943 done
@@ -56,15 +60,31 @@ jobs:
5660
5761 - name : Build release binaries
5862 run : |
63+ set -euo pipefail
5964 mkdir -p dist
60- for GOARCH in amd64 arm64; do
61- bin="dist/drawbridge-linux-${GOARCH}"
62- GOOS=linux GOARCH=$GOARCH CGO_ENABLED=0 go build -o "$bin" .
65+ for GOOS in linux darwin windows; do
66+ for GOARCH in amd64 arm64; do
67+ ext=""
68+ if [ "$GOOS" = "windows" ]; then
69+ ext=".exe"
70+ fi
71+ bin="dist/drawbridge-${GOOS}-${GOARCH}${ext}"
72+ GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -o "$bin" .
73+ done
6374 done
6475
65- - name : Publish release
66- uses : softprops/action-gh-release@v2
67- with :
68- name : ${{ github.ref_name }}
69- tag_name : ${{ github.ref_name }}
70- files : dist/*
76+ - name : Create or fetch release
77+ env :
78+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
79+ TAG_NAME : ${{ github.ref_name }}
80+ run : |
81+ set -euo pipefail
82+ gh release view "$TAG_NAME" >/dev/null 2>&1 || gh release create "$TAG_NAME" --title "$TAG_NAME" --notes ""
83+
84+ - name : Upload release assets
85+ env :
86+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
87+ TAG_NAME : ${{ github.ref_name }}
88+ run : |
89+ set -euo pipefail
90+ gh release upload "$TAG_NAME" dist/* --clobber
0 commit comments