Skip to content

Create the GitHub release from the changelog on a version tag - #69

Open
teknogeek0 wants to merge 1 commit into
mainfrom
ci/release-automation
Open

teknogeek0 wants to merge 1 commit into
mainfrom
ci/release-automation

Conversation

@teknogeek0

Copy link
Copy Markdown
Collaborator

The v0.20.0 tag published the container images but no GitHub release, because
nothing creates one. The v0.19.0 release was made by hand. This automates it.

ci/release-notes.sh

Reads the section for a tag from CHANGELOG.md, normalizes ### to ## and
* to -, and appends the compare link against the previous tag. Exits
non-zero when no section matches, naming both header forms it looked for.

Tag to section: tries vX.Y.Z first, then vX.Y, because headers read
### pgcopydb v0.20 (September 2026) ### while tags are v0.20.0.

Run it locally with make release-notes TAG=v0.20.0.

.github/workflows/release.yml

Triggers on a vX.Y.Z tag, builds the notes and creates the release. Also
takes a tag as a workflow_dispatch input, to backfill a release for an
existing tag.

Skips a tag that already has a release, so a re-run cannot overwrite notes
edited in the UI. Top-level permissions: {}, contents: write on the job
only, persist-credentials: false, checkout pinned to the SHA the other
workflows use.

It is separate from docker-publish.yml rather than a job inside it. Both
start on a tag push, so the release can appear before the images. The trade is
distinguishable failures over strict ordering; the dispatch input covers
re-running either half.

Changelog gate

Three lines in the existing docs job check that CHANGELOG.md has a section
for the version in GIT-VERSION-GEN, so a version bump without a changelog
entry fails at PR time rather than at tag time. It reuses the same extraction
the release workflow uses, so CI validates the text that becomes the notes.

DEF_VER only moves in a release PR, so a feature PR is not required to touch
the changelog.

Checks

  • Generated notes for v0.20.0 are byte-identical to the release published by
    hand, apart from a trailing blank line
  • v0.19.0, v0.17, v0.2 produce correct output; v0.1 correctly omits the
    compare link, having no predecessor
  • Missing section exits 1, bad usage exits 64
  • The gate passes against DEF_VER=0.20 and fails for a bump to v0.21
  • The existing-release guard resolves to "skip" when run against v0.20.0
  • zizmor: no findings for release.yml; run-tests-tiered.yml reports the
    same 16 findings with and without this change

Add ci/release-notes.sh. It reads the section for a tag from CHANGELOG.md,
normalizes the headings and bullets, appends the compare link against the
previous tag, and exits non-zero when no section matches.

Add .github/workflows/release.yml. On a vX.Y.Z tag it builds the notes and
creates the release. It skips a tag that already has a release, and takes a
tag as input for a manual run.

Check in CI that CHANGELOG.md has a section for the version in
GIT-VERSION-GEN.

Add a release-notes make target.
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