Skip to content

Commit 4f5d086

Browse files
committed
Enhance release workflow to support manual dispatch with customizable tag and release names
1 parent ce53d76 commit 4f5d086

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
name: Release Go Binaries
22

3+
# Trigger workflow on tag push or manual dispatch
34
on:
45
push:
56
tags:
67
- 'v*'
8+
workflow_dispatch:
9+
inputs:
10+
tag_name:
11+
description: 'Tag name for the release (e.g., v1.0.0)'
12+
required: true
13+
default: 'manual-release'
14+
release_name:
15+
description: 'Name of the release'
16+
required: false
17+
default: 'Manual Release'
718

819
permissions:
920
contents: write # Required for creating releases
@@ -141,11 +152,24 @@ jobs:
141152
cat checksums.txt
142153
shell: bash
143154

155+
- name: Set release info
156+
id: release_info
157+
run: |
158+
# Set tag name - use input value if manually triggered, otherwise use git ref
159+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
160+
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_OUTPUT
161+
echo "RELEASE_NAME=${{ github.event.inputs.release_name }}" >> $GITHUB_OUTPUT
162+
else
163+
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_OUTPUT
164+
echo "RELEASE_NAME=Release ${{ github.ref_name }}" >> $GITHUB_OUTPUT
165+
fi
166+
shell: bash
167+
144168
- name: Create GitHub Release
145169
uses: softprops/action-gh-release@v2
146170
with:
147-
name: Release ${{ github.ref_name }}
148-
tag_name: ${{ github.ref_name }}
171+
name: ${{ steps.release_info.outputs.RELEASE_NAME }}
172+
tag_name: ${{ steps.release_info.outputs.TAG_NAME }}
149173
generate_release_notes: true
150174
make_latest: true
151175
files: |

0 commit comments

Comments
 (0)