Skip to content

Commit bc1c405

Browse files
intel352claude
andcommitted
chore: migrate to GoReleaser, bump action to v7
Replace manual shell build loop + softprops/action-gh-release with GoReleaser for standardized cross-platform builds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2c307ac commit bc1c405

2 files changed

Lines changed: 34 additions & 52 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,30 @@
11
name: Release
2-
32
on:
43
push:
5-
tags:
6-
- 'v*'
7-
4+
tags: ['v*']
85
permissions:
96
contents: write
10-
117
env:
128
GONOSUMCHECK: github.com/GoCodeAlone/*
139
GONOSUMDB: github.com/GoCodeAlone/*
1410
GOPRIVATE: github.com/GoCodeAlone/*
15-
1611
jobs:
1712
release:
18-
name: Build and Release
1913
runs-on: ubuntu-latest
2014
steps:
2115
- uses: actions/checkout@v4
2216
with:
2317
fetch-depth: 0
24-
2518
- uses: actions/setup-go@v5
2619
with:
2720
go-version: '1.26'
2821
cache: true
29-
3022
- name: Configure git for private modules
3123
run: git config --global url."https://${{ secrets.RELEASES_TOKEN }}@github.com/".insteadOf "https://github.com/"
32-
33-
- name: Resolve dependencies
34-
run: go mod tidy
35-
36-
- name: Build binaries
37-
run: |
38-
VERSION=${GITHUB_REF#refs/tags/}
39-
LDFLAGS="-ldflags \"-X main.version=${VERSION}\""
40-
41-
declare -a PLATFORMS=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64")
42-
mkdir -p bin
43-
44-
for platform in "${PLATFORMS[@]}"; do
45-
os="${platform%%/*}"
46-
arch="${platform##*/}"
47-
output="bin/workflow-plugin-bento-${os}-${arch}"
48-
echo "Building ${output}..."
49-
GOOS=${os} GOARCH=${arch} go build -ldflags "-X main.version=${VERSION}" \
50-
-o "${output}" ./cmd/workflow-plugin-bento
51-
done
52-
53-
ls -la bin/
54-
55-
- name: Create release archives
56-
run: |
57-
mkdir -p dist
58-
for binary in bin/workflow-plugin-bento-*; do
59-
name=$(basename "${binary}")
60-
tar -czf "dist/${name}.tar.gz" -C bin "${name}"
61-
sha256sum "dist/${name}.tar.gz" >> dist/checksums.txt
62-
done
63-
cp plugin.json dist/ 2>/dev/null || echo '{"name":"workflow-plugin-bento","version":"'${GITHUB_REF#refs/tags/}'"}' > dist/plugin.json
64-
ls -la dist/
65-
66-
- name: Create GitHub Release
67-
uses: softprops/action-gh-release@v2
24+
- name: Run GoReleaser
25+
uses: goreleaser/goreleaser-action@v7
6826
with:
69-
files: |
70-
dist/*.tar.gz
71-
dist/checksums.txt
72-
dist/plugin.json
73-
generate_release_notes: true
74-
draft: false
75-
prerelease: false
27+
version: '~> v2'
28+
args: release --clean
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }}

.goreleaser.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
version: 2
2+
3+
builds:
4+
- main: ./cmd/workflow-plugin-bento
5+
binary: workflow-plugin-bento
6+
env:
7+
- CGO_ENABLED=0
8+
goos:
9+
- linux
10+
- darwin
11+
goarch:
12+
- amd64
13+
- arm64
14+
ldflags:
15+
- -s -w -X main.version={{.Version}}
16+
17+
archives:
18+
- formats: [tar.gz]
19+
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
20+
files:
21+
- plugin.json
22+
23+
checksum:
24+
name_template: checksums.txt
25+
26+
changelog:
27+
sort: asc

0 commit comments

Comments
 (0)