Skip to content

Commit 241513b

Browse files
committed
feat: enhance release workflow with linting, testing, and cross-platform builds
1 parent 52d087b commit 241513b

File tree

3 files changed

+444
-26
lines changed

3 files changed

+444
-26
lines changed

.github/workflows/release.yml

Lines changed: 76 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,93 @@ on:
44
push:
55
tags:
66
- "v*.*.*"
7-
workflow_dispatch:
87

98
jobs:
9+
lint-and-test:
10+
name: Lint and test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout the repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: "1.24"
20+
21+
- name: Cache Go modules
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.cache/go-build
26+
~/go/pkg/mod
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
31+
- name: Download dependencies
32+
run: go mod download
33+
34+
- name: Run go vet
35+
run: go vet ./...
36+
37+
- name: Run go fmt check
38+
run: |
39+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
40+
echo "The following files are not formatted:"
41+
gofmt -s -l .
42+
exit 1
43+
fi
44+
45+
- name: Run tests
46+
run: go test -v ./...
47+
48+
- name: Build check
49+
run: go build -v .
50+
1051
release-binaries:
11-
name: Generate cross-platform builds
52+
name: Generate cross-platform builds and create release
1253
runs-on: ubuntu-latest
54+
needs: lint-and-test
55+
permissions:
56+
contents: write
1357
steps:
1458
- name: Checkout the repository
1559
uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0 # Fetch all history for version detection
62+
63+
- name: Set up Go
64+
uses: actions/setup-go@v5
65+
with:
66+
go-version: "1.24"
67+
68+
- name: Cache Go modules
69+
uses: actions/cache@v4
70+
with:
71+
path: |
72+
~/.cache/go-build
73+
~/go/pkg/mod
74+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
75+
restore-keys: |
76+
${{ runner.os }}-go-
77+
78+
- name: Generate build files using build script
79+
run: |
80+
chmod +x scripts/build.sh
81+
./scripts/build.sh
1682
17-
- name: Generate build files
18-
uses: thatisuday/go-cross-build@v1
83+
- name: Create draft release and upload assets
84+
uses: softprops/action-gh-release@v2
1985
with:
20-
platforms: |
21-
linux/amd64,
22-
linux/386,
23-
linux/ppc64,
24-
linux/ppc64le,
25-
linux/mips64,
26-
linux/mips64le,
27-
darwin/amd64,
28-
windows/amd64,
29-
windows/386,
30-
freebsd/amd64,
31-
netbsd/amd64,
32-
openbsd/amd64,
33-
dragonfly/amd64,
34-
plan9/amd64,
35-
plan9/386,
36-
solaris/amd64
37-
package: ""
38-
name: "pulse-bridge"
39-
compress: "false"
40-
dest: "dist"
86+
draft: true
87+
files: builds/*
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4190

4291
build-and-push-docker-image:
4392
runs-on: ubuntu-latest
93+
needs: lint-and-test
4494

4595
permissions:
4696
contents: read
@@ -65,7 +115,7 @@ jobs:
65115
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
66116

67117
- name: Build and push Docker image with GHA cache
68-
uses: docker/build-push-action@v5
118+
uses: docker/build-push-action@v6
69119
with:
70120
context: .
71121
push: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
bin/
22
.env
3+
builds/

0 commit comments

Comments
 (0)