File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed
Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build & Release Go
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ build :
9+ name : Build & Test
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v4
15+
16+ - name : Set up Go
17+ uses : actions/setup-go@v5
18+ with :
19+ go-version : ' 1.23.x'
20+ check-latest : true
21+
22+ - name : Cache Go modules
23+ uses : actions/cache@v4
24+ with :
25+ path : |
26+ ~/go/pkg/mod
27+ ~/.cache/go-build
28+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+ restore-keys : |
30+ ${{ runner.os }}-go-
31+
32+ - name : Install dependencies
33+ run : go mod tidy
34+
35+ - name : Run tests
36+ run : go test ./... -v
37+
38+ - name : Build binaries
39+ run : |
40+ mkdir -p dist
41+ GOOS=linux GOARCH=amd64 go build -o dist/${{ github.event.repository.name }}-linux-amd64
42+ GOOS=linux GOARCH=arm64 go build -o dist/${{ github.event.repository.name }}-linux-arm64
43+ GOOS=darwin GOARCH=amd64 go build -o dist/${{ github.event.repository.name }}-darwin-amd64
44+ GOOS=windows GOARCH=amd64 go build -o dist/${{ github.event.repository.name }}-windows-amd64.exe
45+
46+ - name : Upload build artifacts
47+ uses : actions/upload-artifact@v4
48+ with :
49+ name : go-binaries
50+ path : dist/*
51+
52+ release :
53+ name : Release
54+ needs : build
55+ runs-on : ubuntu-latest
56+
57+ steps :
58+ - name : Attach binaries to release
59+ uses : softprops/action-gh-release@v2
60+ with :
61+ files : dist/*
62+ tag_name : ${{ github.event.release.tag_name }}
63+ env :
64+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments