Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 68 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ name: Release

on:
workflow_dispatch:
inputs:
mode:
description: 'Run mode'
type: choice
options:
- snapshot
- release
default: snapshot
tag:
description: 'Release tag (required for release mode, e.g., v0.5.0)'
required: false
type: string
draft:
description: 'Publish as draft (release mode only)'
required: false
type: boolean
default: true

permissions:
contents: write
Expand All @@ -10,6 +27,12 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Validate inputs
if: inputs.mode == 'release' && inputs.tag == ''
run: |
echo "::error::tag is required when mode=release"
exit 1

- name: Check out code
uses: actions/checkout@v6
with:
Expand All @@ -20,11 +43,54 @@ jobs:
with:
go-version-file: go.mod

- name: Run GoReleaser
- name: Set up Zig
uses: mlugg/setup-zig@v2
with:
version: 0.16.0

- name: Build ABE payload
run: make payload

Comment on lines +51 to +53
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make payload is run as a standalone workflow step, but the PR description indicates this should be handled by GoReleaser (before.hooks). Keeping the payload generation in only one place will reduce drift (e.g., local goreleaser release --snapshot vs CI) and make it clearer which component owns the Zig/payload prerequisite.

Suggested change
- name: Build ABE payload
run: make payload

Copilot uses AI. Check for mistakes.
- name: Create and push tag
if: inputs.mode == 'release'
env:
TAG: ${{ inputs.tag }}
run: |
if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null 2>&1; then
echo "::error::Tag '$TAG' already exists locally"
exit 1
fi
if git ls-remote --tags --exit-code origin "refs/tags/$TAG" >/dev/null 2>&1; then
echo "::error::Tag '$TAG' already exists on origin"
exit 1
fi
git tag -- "$TAG"
git push origin -- "$TAG"

- name: Run GoReleaser (snapshot)
if: inputs.mode == 'snapshot'
uses: goreleaser/goreleaser-action@v7
with:
version: '~> v2'
args: release --clean --draft
args: release --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

- name: Run GoReleaser (release)
if: inputs.mode == 'release'
uses: goreleaser/goreleaser-action@v7
with:
version: '~> v2'
args: release --clean ${{ inputs.draft && '--draft' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

- name: Upload snapshot artifacts
if: inputs.mode == 'snapshot'
uses: actions/upload-artifact@v4
with:
name: snapshot-dist
path: dist/
retention-days: 7
22 changes: 22 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ before:
- go mod tidy

builds:
- id: "hack-browser-data-windows-amd64"
main: ./cmd/hack-browser-data/
binary: hack-browser-data
env:
- CGO_ENABLED=0
goos: [windows]
goarch: [amd64]
tags:
- abe_embed
flags:
- -trimpath
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.ShortCommit}}
- -X main.buildDate={{.Date}}

- id: "hack-browser-data"
main: ./cmd/hack-browser-data/
binary: hack-browser-data
Expand All @@ -15,6 +32,8 @@ builds:
ignore:
- goos: darwin
goarch: "386"
- goos: windows
goarch: amd64
- goos: windows
goarch: "386"
- goos: windows
Expand All @@ -29,6 +48,9 @@ builds:

archives:
- id: "archive"
ids:
- hack-browser-data-windows-amd64
- hack-browser-data
formats:
- tar.gz
format_overrides:
Expand Down
Loading