Implement GitHub release creation in CI workflow#730
Conversation
Add GitHub release step to CI workflow for versioned releases.
There was a problem hiding this comment.
Pull request overview
Adds automated GitHub Release creation to the CI workflow so that pushes to main can produce a versioned GitHub release after a successful npm publish.
Changes:
- Introduces a new
github-releasejob gated topushevents onmain. - Computes the release tag from
package.jsonversion and creates the release with generated notes, skipping if the release already exists.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo "Tag $TAG already exists on origin. Creating release from existing tag." | ||
| gh release create "$TAG" --verify-tag --generate-notes | ||
| else | ||
| echo "Creating tag and release $TAG from commit $GITHUB_SHA." | ||
| gh release create "$TAG" --target "$GITHUB_SHA" --generate-notes |
There was a problem hiding this comment.
When the tag already exists on origin, this creates the release from that tag without confirming it points to the same commit that was just published to npm. If refs/tags/$TAG targets a different commit than $GITHUB_SHA, this can produce a GitHub release whose code/release notes don’t match the published package. Consider verifying the tag’s target commit matches $GITHUB_SHA (and failing if it doesn’t) before creating the release.
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| TAG="v$(node -p "require('./package.json').version")" |
There was a problem hiding this comment.
The TAG assignment uses nested double-quotes (TAG="v$(node -p "require('./package.json').version")"), which will be parsed incorrectly by bash and fail before the release logic runs. Use single-quotes around the Node expression or otherwise escape the inner quotes so the command substitution is valid.
| TAG="v$(node -p "require('./package.json').version")" | |
| TAG="v$(node -p 'require("./package.json").version')" |
Add GitHub release step to CI workflow for versioned releases.