Uh oh!
There was an error while loading. Please reload this page.
release.yml: create a GitHub Release from the CHANGELOG section on tag push - #4
Merged
Merged
Conversation
…g push Add an unconditional release job that runs after the publish jobs succeed. It extracts the section for the released version from CHANGELOG.md (tags carry a leading v, headings do not: v0.1.0 -> ## 0.1.0) and runs gh release create with those lines as the notes. A missing section or a missing CHANGELOG.md fails the job. The job needs whichever build and publish jobs the answer set produces (wheels+sdist or build, plus publish and/or image), so no release object is created when a publish job fails. It is the only job with contents: write; the workflow default stays contents: read. Scaffold template/CHANGELOG.md.jinja with an initial ## 0.0.1.dev0 section matching the pyproject version so a generated project passes the gate on its first release. Document the release-object step in README.md and SETUP.md.jinja. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Adds GitHub Release creation to the templated release workflow.
What it does
A new
releasejob runs after the publish jobs succeed. It derives the version from the pushed tag (stripping the leadingv; house convention is## <version>headings, sov0.1.0maps to## 0.1.0), extracts that section fromCHANGELOG.md, and runsgh release create "$TAG" --verify-tag --title "$TAG" --notes-file <extracted>withGH_TOKEN: ${{ github.token }}.The section extraction is POSIX
awk: it prints the body between the matching## <version>heading and the next##heading, and handles the last-section-in-file case (body runs to EOF).Fail-on-missing-section gate
The job fails if
CHANGELOG.mdhas no section for the version, and equally ifCHANGELOG.mdis absent. This is a deliberate release-discipline gate, not a skip.Permissions and needs
contents: read; only thereleasejob getscontents: write.needs:the build job(s) plus whichever publish jobs the answer set produces, so no release object is created when a publish job fails. Resolved combinations (native × pypi × web):[build, check-version, publish][build, check-version, publish, image][build, check-version][wheels, sdist, check-version, publish]CHANGELOG scaffold
The template did not scaffold a
CHANGELOG.md. Addedtemplate/CHANGELOG.md.jinjawith an initial## 0.0.1.dev0section matching the hardcoded pyproject version, so a freshly generated project passes the gate on its first release.Docs
Documented the release-object behavior in
README.md(Release pipeline) andtemplate/SETUP.md.jinja(release step), in the existing register.Validation
Rendered the template with copier for library, web-service, and no-pypi answer sets;
yaml.safe_loadon the generatedrelease.ymlfor all eight flag combinations; everyneedsentry references a real job. Exercised the extraction shell for middle, date-suffixed, last, and missing sections plus a missing file.Tracker: workspace#66 (private).
🤖 Generated with Claude Code