Skip to content

Commit 7be2b09

Browse files
committed
Add workflow_dispatch support for manual release version input
1 parent 7cb99ac commit 7be2b09

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Release version (e.g., v1.0.0)'
11+
required: true
12+
type: string
713

814
permissions:
915
contents: write
@@ -20,7 +26,12 @@ jobs:
2026

2127
- name: 🏷️ Get version
2228
id: version
23-
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
29+
run: |
30+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
31+
echo "tag=${{ inputs.version }}" >> $GITHUB_OUTPUT
32+
else
33+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
34+
fi
2435
2536
- name: 🎉 Create Release
2637
uses: softprops/action-gh-release@v2
@@ -83,7 +94,12 @@ jobs:
8394

8495
- name: 🏷️ Get version
8596
id: version
86-
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
97+
run: |
98+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
99+
echo "tag=${{ inputs.version }}" >> $GITHUB_OUTPUT
100+
else
101+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
102+
fi
87103
88104
- name: 🔑 Login to Docker Hub (Optional)
89105
continue-on-error: true

0 commit comments

Comments
 (0)