Skip to content

Commit 7dbef59

Browse files
Add manual trigger for release workflow
- Add workflow_dispatch with version input - Add dry_run option to test without publishing - Auto-create and push tag when triggered manually
1 parent 0fb2601 commit 7dbef59

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., v0.1.0)'
11+
required: true
12+
type: string
13+
dry_run:
14+
description: 'Dry run (no actual release)'
15+
required: false
16+
type: boolean
17+
default: false
718

819
permissions:
920
contents: write
@@ -21,11 +32,30 @@ jobs:
2132
with:
2233
go-version: '1.24'
2334

35+
- name: Create and push tag
36+
if: github.event_name == 'workflow_dispatch' && !inputs.dry_run
37+
run: |
38+
git config user.name "github-actions[bot]"
39+
git config user.email "github-actions[bot]@users.noreply.github.com"
40+
git tag -a ${{ inputs.version }} -m "Release ${{ inputs.version }}"
41+
git push origin ${{ inputs.version }}
42+
2443
- name: Run GoReleaser
44+
if: ${{ !inputs.dry_run }}
2545
uses: goreleaser/goreleaser-action@v5
2646
with:
2747
distribution: goreleaser
2848
version: latest
2949
args: release --clean
3050
env:
3151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Run GoReleaser (dry run)
54+
if: ${{ inputs.dry_run }}
55+
uses: goreleaser/goreleaser-action@v5
56+
with:
57+
distribution: goreleaser
58+
version: latest
59+
args: release --clean --snapshot --skip=publish
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)