Skip to content

ci: publish a GitHub release when a version bump is merged - #69

Merged
datacas merged 2 commits into
mainfrom
release-on-merge
Sep 24, 2026
Merged

datacas merged 2 commits into
mainfrom
release-on-merge

Conversation

@datacas

@datacas datacas commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Summary

Releases are now published automatically when a version bump is merged. Until now, merging a release PR (e.g. #66) only changed files, and the tag and GitHub release had to be created by hand.

How it works

.github/workflows/release.yml:

  1. Triggers on workflow_run of Validate package when it completes on main from a push, and only when it succeeded. A release never points at a commit CI didn't pass. It can also be run manually (workflow_dispatch).
  2. Checks out the validated commit (workflow_run.head_sha).
  3. Reads version from .claude-plugin/plugin.json and .codex-plugin/plugin.json, and fails if they disagree.
  4. If vX.Y.Z already exists on the remote, it stops. An ordinary merge that leaves the version unchanged does nothing.
  5. Otherwise it extracts the ## [X.Y.Z] section from CHANGELOG.md and fails if the section is missing or empty. It then runs gh release create vX.Y.Z --target <sha> with those notes plus a link to the tagged CHANGELOG.

Permissions: contents: read at the workflow level, and contents: write only for the release job, using GITHUB_TOKEN.

Releasing is now: bump both manifests, move [Unreleased] to ## [X.Y.Z] - date, and merge.

CONTRIBUTING.md's release checklist and CHANGELOG.md ([Unreleased] → Added) describe this.

Verification

  • YAML parses. actionlint isn't available locally.
  • The notes extraction (the same awk) run against the current CHANGELOG.md: 0.3.0 yields its 393-line section, and a non-existent version yields nothing, which the workflow turns into a failure.
  • python3 scripts/validate-package.py: VALID. Unit tests: OK.
  • Not verified end to end: workflow_run workflows only run from the default branch, so this can't fire before it is merged. After merging, the first Validate package run on main will trigger it. Since v0.3.0 already exists, the expected result is "Tag v0.3.0 already exists; nothing to release."

Note: CHANGELOG.md will conflict trivially with #68, since both add under [Unreleased]. Whichever merges second needs both entries kept.

After Validate package succeeds for a push to main, read the version
from both plugin manifests, and if no vX.Y.Z tag exists, tag that
commit and publish a release whose notes are the version's CHANGELOG
section. Merges that keep the version release nothing; a missing
CHANGELOG section fails instead of publishing empty notes.
@datacas
datacas merged commit 6279bbb into main Sep 24, 2026
4 checks passed
@datacas
datacas deleted the release-on-merge branch October 6, 2026 07:53
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