Skip to content

Commit c34ae21

Browse files
committed
ci(release): integrate Windows ABE payload into goreleaser
- Add `make payload` to before.hooks (zig 0.16.0 via mlugg/setup-zig@v2) - Split windows/amd64 into dedicated build with abe_embed tag - Add workflow inputs: mode (snapshot/release), tag, draft - Snapshot mode uploads dist/ as artifact for verification
1 parent 15680c1 commit c34ae21

2 files changed

Lines changed: 78 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ name: Release
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
mode:
7+
description: 'Run mode'
8+
type: choice
9+
options:
10+
- snapshot
11+
- release
12+
default: snapshot
13+
tag:
14+
description: 'Release tag (required for release mode, e.g., v0.5.0)'
15+
required: false
16+
type: string
17+
draft:
18+
description: 'Publish as draft (release mode only)'
19+
required: false
20+
type: boolean
21+
default: true
522

623
permissions:
724
contents: write
@@ -10,6 +27,12 @@ jobs:
1027
goreleaser:
1128
runs-on: ubuntu-latest
1229
steps:
30+
- name: Validate inputs
31+
if: inputs.mode == 'release' && inputs.tag == ''
32+
run: |
33+
echo "::error::tag is required when mode=release"
34+
exit 1
35+
1336
- name: Check out code
1437
uses: actions/checkout@v6
1538
with:
@@ -20,11 +43,41 @@ jobs:
2043
with:
2144
go-version-file: go.mod
2245

23-
- name: Run GoReleaser
46+
- name: Set up Zig
47+
uses: mlugg/setup-zig@v2
48+
with:
49+
version: 0.16.0
50+
51+
- name: Create and push tag
52+
if: inputs.mode == 'release'
53+
run: |
54+
git tag ${{ inputs.tag }}
55+
git push origin ${{ inputs.tag }}
56+
57+
- name: Run GoReleaser (snapshot)
58+
if: inputs.mode == 'snapshot'
2459
uses: goreleaser/goreleaser-action@v7
2560
with:
2661
version: '~> v2'
27-
args: release --clean --draft
62+
args: release --snapshot --clean
2863
env:
2964
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3065
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
66+
67+
- name: Run GoReleaser (release)
68+
if: inputs.mode == 'release'
69+
uses: goreleaser/goreleaser-action@v7
70+
with:
71+
version: '~> v2'
72+
args: release --clean ${{ inputs.draft && '--draft' || '' }}
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
76+
77+
- name: Upload snapshot artifacts
78+
if: inputs.mode == 'snapshot'
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: snapshot-dist
82+
path: dist/
83+
retention-days: 7

.goreleaser.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@ version: 2
33
before:
44
hooks:
55
- go mod tidy
6+
- make payload
67

78
builds:
9+
- id: "hack-browser-data-windows-amd64"
10+
main: ./cmd/hack-browser-data/
11+
binary: hack-browser-data
12+
env:
13+
- CGO_ENABLED=0
14+
goos: [windows]
15+
goarch: [amd64]
16+
tags:
17+
- abe_embed
18+
flags:
19+
- -trimpath
20+
ldflags:
21+
- -s -w
22+
- -X main.version={{.Version}}
23+
- -X main.commit={{.ShortCommit}}
24+
- -X main.buildDate={{.Date}}
25+
826
- id: "hack-browser-data"
927
main: ./cmd/hack-browser-data/
1028
binary: hack-browser-data
@@ -15,6 +33,8 @@ builds:
1533
ignore:
1634
- goos: darwin
1735
goarch: "386"
36+
- goos: windows
37+
goarch: amd64
1838
- goos: windows
1939
goarch: "386"
2040
- goos: windows
@@ -29,6 +49,9 @@ builds:
2949

3050
archives:
3151
- id: "archive"
52+
ids:
53+
- hack-browser-data-windows-amd64
54+
- hack-browser-data
3255
formats:
3356
- tar.gz
3457
format_overrides:

0 commit comments

Comments
 (0)