Skip to content

Automate GitHub Releases on version tag push - #515

Merged
adeelraza merged 1 commit into
masterfrom
claude/release-automation
Aug 11, 2026
Merged

Automate GitHub Releases on version tag push#515
adeelraza merged 1 commit into
masterfrom
claude/release-automation

Conversation

@adeelraza

Copy link
Copy Markdown
Contributor

Makes npm run release also 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 release locally (on master, after the version-bump PR is merged):

  1. npm run build
  2. npm publish — local, with your 2FA (unchanged)
  3. npm run release:taggit tag vX.Y.Z && git push origin vX.Y.Z

Pushing the vX.Y.Z tag triggers the new .github/workflows/release.yml, which:

  • extracts the ## X.Y.Z (...) section from CHANGELOG.md,
  • runs gh release create vX.Y.Z with those notes (via the built-in GITHUB_TOKEN),
  • marks the release as a prerelease if the tag contains a hyphen (e.g. v1.7.0-beta.0),
  • falls back to a CHANGELOG link if no matching section exists.

So going forward there's still one command — the GitHub Release appears on its own once the tag lands.

Changes

  • package.json: release now appends npm run release:tag; new release:tag script.
  • .github/workflows/release.yml: new, on: push: tags: ['v*'], permissions: contents: write.

Validated locally

  • npm_package_version resolves in the script env → git tag v2.1.2 && git push origin v2.1.2.
  • CHANGELOG extraction verified for a single-section version (2.1.2) and a multi-section one (2.1.0 → Added + Changed, stopping before 2.0.0).
  • Prettier clean.

Notes

  • Publish order is publish-then-tag, so a failed/cancelled npm publish won't leave a dangling tag.
  • Existing tags (v2.0.0, v2.1.2) are untouched; automation applies to the next release (2.1.3+).
  • Not included: moving npm publish into CI via an OIDC Trusted Publisher (would make it fully hands-off but needs registering the publisher on npmjs.com). Easy follow-up if you want it later.

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)
@adeelraza
adeelraza merged commit 3a9fff2 into master Aug 11, 2026
13 checks passed
@adeelraza
adeelraza deleted the claude/release-automation branch August 11, 2026 16:15
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.25%. Comparing base (0155e26) to head (4b36005).
⚠️ Report is 2 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant