Automate GitHub Releases on version tag push - #515
Merged
Conversation
npm publish stays local (npm run release, using the maintainer's 2FA). The release script now also pushes a vX.Y.Z tag, and a new release.yml workflow fires on that tag to create the matching GitHub Release with notes extracted from the CHANGELOG section for that version. - release script: append 'npm run release:tag' (git tag + push) - release:tag: git tag v$npm_package_version && git push origin <tag> - .github/workflows/release.yml: on push tag v* -> gh release create (prereleases detected by a hyphen in the tag; falls back to a CHANGELOG link if no matching section is found)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #515 +/- ##
=======================================
Coverage 96.25% 96.25%
=======================================
Files 2 2
Lines 80 80
Branches 20 20
=======================================
Hits 77 77
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Makes
npm run releasealso create the GitHub Release, so npm and GitHub Releases stay in sync automatically. Publishing stays local (your 2FA); CI only handles the GitHub Release.Flow
Running
npm run releaselocally (onmaster, after the version-bump PR is merged):npm run buildnpm publish— local, with your 2FA (unchanged)npm run release:tag—git tag vX.Y.Z && git push origin vX.Y.ZPushing the
vX.Y.Ztag triggers the new.github/workflows/release.yml, which:## X.Y.Z (...)section fromCHANGELOG.md,gh release create vX.Y.Zwith those notes (via the built-inGITHUB_TOKEN),v1.7.0-beta.0),So going forward there's still one command — the GitHub Release appears on its own once the tag lands.
Changes
package.json:releasenow appendsnpm run release:tag; newrelease:tagscript..github/workflows/release.yml: new,on: push: tags: ['v*'],permissions: contents: write.Validated locally
npm_package_versionresolves in the script env →git tag v2.1.2 && git push origin v2.1.2.Notes
npm publishwon't leave a dangling tag.v2.0.0,v2.1.2) are untouched; automation applies to the next release (2.1.3+).