1+ name : Build and Release Custom Debugger
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+ branches :
8+ - main
9+ - publish-workflow
10+ workflow_dispatch :
11+ inputs :
12+ version :
13+ description : ' Version to release (e.g., 1.0.0)'
14+ required : true
15+ type : string
16+ create_release :
17+ description : ' Create GitHub release'
18+ required : false
19+ type : boolean
20+ default : true
21+
22+ jobs :
23+ build :
24+ runs-on : ubuntu-latest
25+
26+ strategy :
27+ matrix :
28+ goos : [linux, darwin, windows]
29+ goarch : [amd64, arm64]
30+ exclude :
31+ # Exclude windows/arm64 as it's not commonly supported
32+ - goos : windows
33+ goarch : arm64
34+
35+ steps :
36+ - name : Checkout code
37+ uses : actions/checkout@v4
38+
39+ - name : Set up Go
40+ uses : actions/setup-go@v4
41+ with :
42+ go-version : ' 1.23'
43+ cache : true
44+
45+ - name : Build custom-debugger
46+ run : |
47+ cd custom-debugger
48+ GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o tdlv-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }} .
49+
50+ - name : Upload build artifact
51+ uses : actions/upload-artifact@v4
52+ with :
53+ name : tdlv-${{ matrix.goos }}-${{ matrix.goarch }}
54+ path : custom-debugger/tdlv-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
55+
56+ release :
57+ needs : build
58+ runs-on : ubuntu-latest
59+ if : startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true')
60+
61+ steps :
62+ - name : Checkout code
63+ uses : actions/checkout@v4
64+
65+ - name : Download all artifacts
66+ uses : actions/download-artifact@v4
67+ with :
68+ path : artifacts
69+
70+ - name : Create release
71+ uses : softprops/action-gh-release@v1
72+ with :
73+ files : |
74+ artifacts/tdlv-linux-amd64/tdlv-linux-amd64
75+ artifacts/tdlv-linux-arm64/tdlv-linux-arm64
76+ artifacts/tdlv-darwin-amd64/tdlv-darwin-amd64
77+ artifacts/tdlv-darwin-arm64/tdlv-darwin-arm64
78+ artifacts/tdlv-windows-amd64/tdlv-windows-amd64.exe
79+ draft : false
80+ prerelease : false
81+ generate_release_notes : true
82+ env :
83+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments