Skip to content

Commit c6cc351

Browse files
committed
ci(publish): add manual version input to workflow dispatch
Allow specifying version manually when triggering workflow dispatch instead of relying solely on git tags.
1 parent b9dfc2e commit c6cc351

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/publish.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
push:
55
tags: [ 'v*' ]
66
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to release (e.g., 1.0.0)'
10+
required: true
11+
type: string
712

813
permissions:
914
contents: write
@@ -15,7 +20,11 @@ jobs:
1520
- name: Set repo name
1621
run: |
1722
echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV
18-
echo "VERSION=$(echo ${{ github.ref }} | cut -d'/' -f3 | cut -c2-)" >> $GITHUB_ENV
23+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
24+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
25+
else
26+
echo "VERSION=$(echo ${{ github.ref }} | cut -d'/' -f3 | cut -c2-)" >> $GITHUB_ENV
27+
fi
1928
- uses: actions/checkout@v4
2029

2130
- name: Set up Lua
@@ -49,7 +58,11 @@ jobs:
4958
- name: Set repo name
5059
run: |
5160
echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV
52-
echo "VERSION=$(echo ${{ github.ref }} | cut -d'/' -f3 | cut -c2-)" >> $GITHUB_ENV
61+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
62+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
63+
else
64+
echo "VERSION=$(echo ${{ github.ref }} | cut -d'/' -f3 | cut -c2-)" >> $GITHUB_ENV
65+
fi
5366
- name: Checkout code
5467
uses: actions/checkout@v4
5568
- name: Download JSON file

0 commit comments

Comments
 (0)