File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release Go Binary
2+
3+ on :
4+ push :
5+ tags :
6+ - " v*"
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ build-and-release :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Go
19+ uses : actions/setup-go@v4
20+ with :
21+ go-version : " 1.21"
22+
23+ - name : Build binaries
24+ run : |
25+ BINARY_NAME="myapp"
26+ VERSION=${GITHUB_REF#refs/tags/}
27+
28+ # Build for Linux
29+ GOOS=linux GOARCH=amd64 go build -o "${BINARY_NAME}-linux-amd64"
30+ tar czf "${BINARY_NAME}-linux-amd64.tar.gz" "${BINARY_NAME}-linux-amd64"
31+
32+ # Build for macOS
33+ GOOS=darwin GOARCH=amd64 go build -o "${BINARY_NAME}-darwin-amd64"
34+ tar czf "${BINARY_NAME}-darwin-amd64.tar.gz" "${BINARY_NAME}-darwin-amd64"
35+
36+ # Build for Windows
37+ GOOS=windows GOARCH=amd64 go build -o "${BINARY_NAME}-windows-amd64.exe"
38+ zip "${BINARY_NAME}-windows-amd64.zip" "${BINARY_NAME}-windows-amd64.exe"
39+
40+ - name : Create Release
41+ uses : softprops/action-gh-release@v1
42+ with :
43+ files : |
44+ myapp-linux-amd64.tar.gz
45+ myapp-darwin-amd64.tar.gz
46+ myapp-windows-amd64.zip
47+ draft : false
48+ prerelease : false
49+ generate_release_notes : true
You can’t perform that action at this time.
0 commit comments