Skip to content

Commit f92110a

Browse files
committed
Fix version parsing for manual release workflow
1 parent 6d81c65 commit f92110a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
release:
44
types: [published]
55
workflow_dispatch:
6+
inputs:
7+
version:
8+
required: true
69
jobs:
710
publish:
811
name: Publish
@@ -24,13 +27,13 @@ jobs:
2427
run: echo "version=$(cat package.json | jq '.version' --raw-output)" >> $GITHUB_OUTPUT
2528
# Abort if the version in the package.json file (prefixed with 'v') doesn't match the tag name of the release
2629
- name: Check package.json version against tag name
27-
if: format('v{0}', steps.package-json-version.outputs.version) != github.event.release.tag_name
30+
if: (github.event_name == 'release' && format('v{0}', steps.package-json-version.outputs.version) != github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && format('v{0}', steps.package-json-version.outputs.version) != inputs.version)
2831
uses: actions/github-script@v7
2932
with:
3033
script: core.setFailed('Release tag does not match package.json version!')
3134
# Abort if this is a pre-release and the version in the package.json file doesn't contain a '-' to indicate that (e.g. v2.0.0-beta.1), or vice-versa
3235
- name: Check package.json version against pre-release
33-
if: contains(steps.package-json-version.outputs.version, '-') != github.event.release.prerelease
36+
if: github.event_name == 'release' && contains(steps.package-json-version.outputs.version, '-') != github.event.release.prerelease
3437
uses: actions/github-script@v7
3538
with:
3639
script: core.setFailed('Stability of release tag does not match package.json version!')

0 commit comments

Comments
 (0)