Skip to content

Commit 1883a75

Browse files
derekparkerclaude
andcommitted
build: allow release workflow to be manually triggered against a tag
Add a 'tag' input to the workflow_dispatch trigger so releases can be re-run or initiated manually for a specific tag. The checkout step uses the provided tag, and GORELEASER_CURRENT_TAG is set so goreleaser picks up the correct version. A validation step ensures non-dry-run releases require a tag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 25e1565 commit 1883a75

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
- 'v*'
77
workflow_dispatch:
88
inputs:
9+
tag:
10+
description: 'Git tag to release (e.g. v1.24.0). Required for non-dry-run releases.'
11+
type: string
12+
required: false
913
dry_run:
1014
description: 'Dry run only (snapshot build, not published to GitHub Releases)'
1115
type: boolean
@@ -24,10 +28,17 @@ jobs:
2428
release:
2529
runs-on: ubuntu-latest
2630
steps:
31+
- name: Validate tag input
32+
if: github.event_name == 'workflow_dispatch' && inputs.dry_run == false && inputs.tag == ''
33+
run: |
34+
echo "::error::A tag must be specified for non-dry-run releases"
35+
exit 1
36+
2737
- name: Checkout
2838
uses: actions/checkout@v4
2939
with:
3040
fetch-depth: 0 # full history required for goreleaser release notes
41+
ref: ${{ inputs.tag || github.ref }}
3142

3243
- name: Set up Go
3344
uses: actions/setup-go@v5
@@ -45,6 +56,7 @@ jobs:
4556
args: release --clean
4657
env:
4758
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
GORELEASER_CURRENT_TAG: ${{ inputs.tag || github.ref_name }}
4860

4961
- name: Run goreleaser (snapshot)
5062
if: github.event_name == 'workflow_dispatch' && inputs.dry_run == true

0 commit comments

Comments
 (0)