1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ jobs :
9+ build-linux :
10+ name : Build (Linux)
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v4
14+ - uses : actions/setup-go@v5
15+ with :
16+ go-version : ' 1.24.1'
17+ - name : Build
18+ env :
19+ GOOS : linux
20+ GOARCH : amd64
21+ CGO_ENABLED : 1
22+ run : |
23+ output=c2c-linux-amd64
24+ go build -o $output ./main.go
25+ echo "artifact=$output" >> $GITHUB_ENV
26+ - uses : actions/upload-artifact@v4
27+ with :
28+ name : ${{ env.artifact }}
29+ path : ${{ env.artifact }}
30+
31+ build-windows :
32+ name : Build (Windows)
33+ runs-on : windows-latest
34+ steps :
35+ - uses : actions/checkout@v4
36+ - uses : actions/setup-go@v5
37+ with :
38+ go-version : ' 1.24.1'
39+ - name : Build
40+ env :
41+ GOOS : windows
42+ GOARCH : amd64
43+ CGO_ENABLED : 1
44+ run : |
45+ $output = "c2c-windows-amd64.exe"
46+ go build -o $output ./main.go
47+ echo "artifact=$output" | Out-File -FilePath $env:GITHUB_ENV -Append
48+ - uses : actions/upload-artifact@v4
49+ with :
50+ name : ${{ env.artifact }}
51+ path : ${{ env.artifact }}
52+
53+ build-macos-amd64 :
54+ name : Build (macOS amd64)
55+ runs-on : macos-latest
56+ steps :
57+ - uses : actions/checkout@v4
58+ - uses : actions/setup-go@v5
59+ with :
60+ go-version : ' 1.24.1'
61+ - name : Build
62+ env :
63+ GOOS : darwin
64+ GOARCH : amd64
65+ CGO_ENABLED : 1
66+ run : |
67+ output=c2c-darwin-amd64
68+ go build -o $output ./main.go
69+ echo "artifact=$output" >> $GITHUB_ENV
70+ - uses : actions/upload-artifact@v4
71+ with :
72+ name : ${{ env.artifact }}
73+ path : ${{ env.artifact }}
74+
75+ build-macos-arm64 :
76+ name : Build (macOS arm64)
77+ runs-on : macos-latest
78+ steps :
79+ - uses : actions/checkout@v4
80+ - uses : actions/setup-go@v5
81+ with :
82+ go-version : ' 1.24.1'
83+ - name : Build
84+ env :
85+ GOOS : darwin
86+ GOARCH : arm64
87+ CGO_ENABLED : 1
88+ run : |
89+ output=c2c-darwin-arm64
90+ go build -o $output ./main.go
91+ echo "artifact=$output" >> $GITHUB_ENV
92+ - uses : actions/upload-artifact@v4
93+ with :
94+ name : ${{ env.artifact }}
95+ path : ${{ env.artifact }}
96+
97+ release :
98+ name : Release
99+ runs-on : ubuntu-latest
100+ needs : [build-linux, build-windows, build-macos-amd64, build-macos-arm64]
101+ steps :
102+ - name : Download artifacts
103+ uses : actions/download-artifact@v4
104+ with :
105+ path : ./dist
106+ - name : List artifacts (debug)
107+ run : ls -R ./dist
108+ - name : Create GitHub Release
109+ uses : softprops/action-gh-release@v2
110+ with :
111+ files : ./dist/**/c2c*
112+ draft : false
113+ prerelease : false
114+ env :
115+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments