Fix: release workflow uses inputs.tag_name for workflow_dispatch#1378
Fix: release workflow uses inputs.tag_name for workflow_dispatch#1378
Conversation
The release workflow was using github.event.release.tag_name which is only set for release events, not workflow_dispatch. Add fallback to inputs.tag_name so manual workflow_dispatch triggers correctly set the package version. Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
There was a problem hiding this comment.
Pull request overview
This PR fixes the release workflow so that the package version is correctly derived when the workflow is triggered via workflow_dispatch, avoiding publishes that fail due to an unchanged/previously-published version.
Changes:
- Update the
Set Package Versionstep to usegithub.event.release.tag_namewith a fallback toinputs.tag_nameforworkflow_dispatch.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uses: reedyuk/npm-version@1.1.1 | ||
| with: | ||
| version: ${{ github.event.release.tag_name }} | ||
| version: ${{ github.event.release.tag_name || inputs.tag_name }} | ||
|
|
||
| - name: Install, Build, and Publish Package |
There was a problem hiding this comment.
This change fixes the version source for the publish step on workflow_dispatch, but the workflow still uses github.event.release.tag_name elsewhere (e.g., the notify-dependents job computes release_version from it). When triggered via workflow_dispatch, that value will still be empty, so downstream notification/version outputs will be wrong. Consider applying the same fallback (or centralizing the resolved tag into a single env/output) so all steps/jobs use the same tag source.
Summary
github.event.release.tag_namein theSet Package Versionstep, which is only populated forreleaseeventsworkflow_dispatch, this evaluates to an empty string, causing the version to not be updated and the publish to fail with "cannot publish over previously published version"${{ github.event.release.tag_name || inputs.tag_name }}to fall back to the workflow dispatch inputTest plan
workflow_dispatchwith a valid version tag (e.g.v0.18.1) and verify the publish succeeds