Skip to content

Commit faf9194

Browse files
committed
ci: add workflow_dispatch for manual npm publish
1 parent 5c354f7 commit faf9194

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
push:
77
tags:
88
- 'v*'
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: 'Tag version to publish (e.g., 0.2.0)'
13+
required: true
14+
type: string
915

1016
permissions:
1117
contents: read
@@ -16,6 +22,8 @@ jobs:
1622
steps:
1723
- name: Checkout
1824
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/v{0}', inputs.tag) || '' }}
1927

2028
- name: Setup Node.js
2129
uses: actions/setup-node@v4
@@ -26,7 +34,11 @@ jobs:
2634

2735
- name: Verify version matches tag
2836
run: |
29-
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
37+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
38+
TAG_VERSION="${{ inputs.tag }}"
39+
else
40+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
41+
fi
3042
PKG_VERSION=$(node -p "require('./package.json').version")
3143
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
3244
echo "Error: Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"

0 commit comments

Comments
 (0)