Create the GitHub release only after the image is published - #256
Merged
Conversation
The release was published first and the image was built from that event, so anything failing in between left a published release whose image had never been pushed. `docker pull` then served the previous version while the release notes described the new one — the exact gap the automated publish was meant to close. It is not hypothetical: releasing 0.34.18 hit it twice, once on a Docker Hub credentials error and once on a GitHub Actions outage that produced a startup failure before any job existed. Trigger the workflow on a `v*` tag being pushed instead, and create the release as the final step, once the image is on Docker Hub. A failed run leaves no release at all, and re-running for the same version finishes the job without cutting a new tag. Triggering on a draft release was not an option: GitHub does not emit release events for drafts. Take the notes from that version's CHANGELOG section via scripts/extract_changelog.py, so the release page and the changelog cannot drift apart, and refuse to release the Unreleased section. Derive prerelease status from the SemVer version, since there is no release object to read it from any more: a tag like v0.35.0-rc1 is published as a prerelease and does not move `latest`. Closes #255
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #255.
The problem
#252 automated the Docker Hub publish but kept the wrong ordering: the release
was published first, and the image was built from that event. Anything failing
in between left a published release whose image had never been pushed, so
docker pullserved the previous version while the release notes described thenew one — the exact gap the automation was meant to close.
Releasing 0.34.18 hit this twice: once on a Docker Hub credentials error, and
once on a GitHub Actions outage that produced a
startup_failurebefore any jobwas created. Both times the release stayed published and Docker Hub kept serving
0.34.17.
The change
The workflow now triggers on a
v*tag being pushed, and creates the release asits final step, once the image is on Docker Hub.
A failed run leaves no release at all. Re-running the workflow for the same
version finishes the job without cutting a new tag — the release step updates an
existing release rather than failing on it.
Triggering on a draft release, as the issue originally proposed, is not
possible: GitHub does not emit
releaseevents for drafts.Release notes
Notes come from that version's
CHANGELOG.mdsection, via the newscripts/extract_changelog.py, so the release page and the changelog cannotdrift apart. Releasing the
Unreleasedsection is refused explicitly, and aversion with no section fails the run before anything is built.
Prereleases
With no release object to read
prereleasefrom, it is derived from the versionitself: a SemVer prerelease identifier (
v0.35.0-rc1) publishes under its owntag only, leaves
latestalone, and marks the GitHub release as a prerelease.Effect on the release procedure
gh release createis no longer run by hand — the workflow does it. Releasing isnow: bump
swagger_versionand the CHANGELOG, commit, then push the tag. TheREADME section is rewritten accordingly.
Testing
running to end of file, the heading and date being dropped, unknown versions,
empty sections, and the three exit codes.
black --check .clean across 253 files;flake8 api/ tests/ scripts/clean.v0.34.19,v0.35.0-rc1,v1.0.0-beta.2andv1.0.0, on both the tag-push and manual-dispatch paths.The workflow's own end-to-end behaviour is first exercised by the next release.