Skip to content

ci: auto-release on package.json version bump#104

Merged
jonathan-pap merged 1 commit into
mainfrom
ci/auto-release-on-version-bump
May 4, 2026
Merged

ci: auto-release on package.json version bump#104
jonathan-pap merged 1 commit into
mainfrom
ci/auto-release-on-version-bump

Conversation

@jonathan-pap
Copy link
Copy Markdown
Owner

Summary

Closes the gap between `package.json` version bumps and the GitHub Releases page.

Tagging stalled after v0.8.1 — PRs kept updating `package.json` + adding `changelog/<x.y.z>.md` shards, but no releases were ever filed. v0.9.0 through v0.11.7 were just backfilled by hand (11 tags + 11 releases). This workflow makes sure the next release happens the same day it merges.

How it works

On every push to `main` that touches `package.json` or `changelog/*.md`:

  1. Diffs `package.json` version against the previous commit; skips if unchanged.
  2. Skips if `v<x.y.z>` tag already exists (idempotent on re-runs).
  3. Refuses if `changelog/<x.y.z>.md` doesn't exist (no silent notes-less releases).
  4. Tags `v<x.y.z>` annotated with the theme line from the changelog file.
  5. Creates a GitHub Release: title `v<x.y.z> — `, body = `changelog/<x.y.z>.md`.

Test plan

  • First merge to main with a version bump should fire the workflow and create the release. The next time you bump (e.g. when the scheduled v0.12.0 agent merges its PR on May 4), the GitHub Releases page should auto-populate with v0.12.0 — no manual step.
  • Path filter limits trigger surface to `package.json` + `changelog/*.md` so it doesn't run on every commit.
  • Workflow uses `fetch-depth: 0` so the prev-version diff has access to history.

Permissions

Adds `permissions: contents: write` (default is `read`) — required for the workflow to push tags and create releases via `GITHUB_TOKEN`.

🤖 Generated with Claude Code

Watches main for changes to package.json. When the version field
changes to a value with no existing tag, the workflow:

  1. Tags v<x.y.z> at the merge commit (annotated with theme from
     changelog/<x.y.z>.md first line).
  2. Pushes the tag.
  3. Creates a GitHub Release with body = the changelog file.

Refuses to release without a matching changelog/<x.y.z>.md file —
shipping notes-less releases is never useful, so fail loud.

Backstory: tagging stalled after v0.8.1; PRs continued to update
package.json + changelog/ but no releases were filed. v0.9.0–v0.11.7
were just backfilled by hand. This closes the loop so future
releases happen the same day they merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jonathan-pap jonathan-pap enabled auto-merge (squash) May 4, 2026 11:12
@jonathan-pap jonathan-pap merged commit 916dbe2 into main May 4, 2026
3 checks passed
@jonathan-pap jonathan-pap deleted the ci/auto-release-on-version-bump branch May 4, 2026 11:13
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