Repository navigation
ci: create the GitHub release when publishing to npm - #474
Merged
Merged
Conversation
The publish workflow now creates "Release vX.Y.Z" after a successful npm publish: it tags the published commit, builds the notes from .github/RELEASE_TEMPLATE.md and attaches the npm tarball. .github/scripts/release-notes.js keeps the template's standing content and fills "What's changed" from the PR titles merged since the previous v* tag, grouped by feat / fix / perf, leaving out chore, ci, test, docs and dependency bumps. "Upgrading" comes from a new optional workflow input and is dropped when empty. A dry run shows the notes in the job summary as a preview. The release is its own job, so a failure after npm has published can be retried on its own, and it updates an existing release instead of failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| body = body.replace(/## Upgrading\s*\n[\s\S]*?(?=^---\s*$)/m, | ||
| upgrading ? `## Upgrading\n\n${upgrading}\n\n` : '') | ||
| // any remaining EDIT ME comments are for the person editing, not the reader | ||
| body = body.replace(/<!--[\s\S]*?-->\s*\n?/g, '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Publishing to npm and releasing on GitHub now happen in one step: a real run of NPM Package Validation and Publish also creates the GitHub release.
What it does
github-releasejob runs after a successful (non dry run) publish:vX.Y.Zon the published commit.github/RELEASE_TEMPLATE.mdlatest, otherwise pre-releaseupgradingfills the Upgrading section. Left empty, the section is dropped.How the notes are built
.github/scripts/release-notes.js(no dependencies):---line and strips the EDIT ME commentsv*tag, grouped as Features / Fixes / Performance / Other, with each PR linkedchore,ci,test,docs,refactorand dependabot bumpsPreview locally:
Testing
--upgrading.github-releasejob itself first runs on the next real publish. Do a dry run first to check the preview.🤖 Generated with Claude Code