Skip to content

CI: tag and cut a GitHub Release on each npm publish - #32

Merged
planadecu merged 1 commit into
mainfrom
ci/github-release-on-publish
Sep 29, 2026
Merged

planadecu merged 1 commit into
mainfrom
ci/github-release-on-publish

Conversation

@planadecu

Copy link
Copy Markdown
Owner

What changed

publish.yml gets a final step. After npm publish succeeds, it tags the version-bump commit as vX.Y.Z, pushes the tag, and creates a matching GitHub Release with auto-generated notes (gh release create --generate-notes). The repo has no tags or releases yet, so the first release's notes cover all history; later ones cover the PRs merged since the previous tag.

Why

Every merge to main publishes to npm, but nothing on GitHub marks which commit became which version. Release notes also give users of the package a changelog.

Notes

  • The job already has permissions: contents: write, which the tag push and release need.
  • A tag pushed with GITHUB_TOKEN doesn't trigger workflows, and publish.yml only runs on pushes to main, so this can't loop.
  • The step only runs after a successful npm publish, so a failed publish creates no tag.

Verification

Merging this PR is itself the test: it publishes 0.2.16 and should create tag v0.2.16 and its GitHub Release.

After npm publish, tag the bump commit as vX.Y.Z, push the tag, and
create a matching GitHub Release with auto-generated notes. Pushing a
tag does not match the branches:[main] trigger, so no CI loop.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QN86rvEYiZrnhp1vAN2YPZ
@planadecu
planadecu merged commit 47e0f55 into main Sep 29, 2026
5 checks passed
@planadecu
planadecu deleted the ci/github-release-on-publish branch September 29, 2026 23:29
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