File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - main
8+ - master
9+ tags :
10+ - " v*"
11+
12+ permissions :
13+ contents : read
14+
15+ jobs :
16+ test :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v4
21+
22+ - name : Set up Go
23+ uses : actions/setup-go@v5
24+ with :
25+ go-version-file : go.mod
26+ cache : true
27+
28+ - name : Run tests
29+ run : go test ./...
30+
31+ - name : Cross-compile binaries
32+ run : |
33+ mkdir -p dist
34+ for GOOS in linux darwin; do
35+ for GOARCH in amd64 arm64; do
36+ bin="dist/drawbridge-${GOOS}-${GOARCH}"
37+ GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -o "$bin" .
38+ done
39+ done
40+
41+ release :
42+ if : startsWith(github.ref, 'refs/tags/v')
43+ needs : test
44+ runs-on : ubuntu-latest
45+ permissions :
46+ contents : write
47+ steps :
48+ - name : Checkout
49+ uses : actions/checkout@v4
50+
51+ - name : Set up Go
52+ uses : actions/setup-go@v5
53+ with :
54+ go-version-file : go.mod
55+ cache : true
56+
57+ - name : Build release binaries
58+ run : |
59+ mkdir -p dist
60+ for GOARCH in amd64 arm64; do
61+ bin="dist/drawbridge-linux-${GOARCH}"
62+ GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -o "$bin" .
63+ done
64+
65+ - name : Publish release
66+ uses : softprops/action-gh-release@v2
67+ with :
68+ name : ${{ github.ref_name }}
69+ tag_name : ${{ github.ref_name }}
70+ files : dist/*
You can’t perform that action at this time.
0 commit comments