Skip to content

Commit 0b441ce

Browse files
committed
ci: add build failure
1 parent 02b4261 commit 0b441ce

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
pull-requests: read
1011

1112
jobs:
1213
build-and-release:
@@ -77,19 +78,41 @@ jobs:
7778
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7879
run: |
7980
next="${{ steps.next.outputs.next }}"
81+
echo "Creating release: $next"
82+
83+
# Create and push tag
8084
git tag "$next"
8185
git push origin "$next"
82-
gh release create "$next" --generate-notes || true
86+
87+
# Create release with proper error handling
88+
if gh release create "$next" --generate-notes; then
89+
echo "Release $next created successfully"
90+
else
91+
echo "Failed to create release $next, but continuing..."
92+
exit 1
93+
fi
8394
8495
- name: Attach binaries (Linux/macOS)
85-
if: always()
96+
if: success()
8697
env:
8798
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8899
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89100
run: |
101+
next="${{ steps.next.outputs.next }}"
102+
echo "Uploading binaries for release: $next"
103+
90104
# Build static binaries for common platforms
91105
mkdir -p dist
92106
GOOS=linux GOARCH=amd64 go build -o dist/golearn-linux-amd64 ./cmd/golearn
93107
GOOS=darwin GOARCH=arm64 go build -o dist/golearn-darwin-arm64 ./cmd/golearn
94-
gh release upload "${{ steps.next.outputs.next }}" dist/* --clobber
108+
GOOS=darwin GOARCH=amd64 go build -o dist/golearn-darwin-amd64 ./cmd/golearn
109+
GOOS=windows GOARCH=amd64 go build -o dist/golearn-windows-amd64.exe ./cmd/golearn
110+
111+
# Upload binaries to the release
112+
if gh release upload "$next" dist/* --clobber; then
113+
echo "Binaries uploaded successfully"
114+
else
115+
echo "Failed to upload binaries"
116+
exit 1
117+
fi
95118

0 commit comments

Comments
 (0)