ci(release): auto-create GitHub Release after PyPI publish#27
Merged
Conversation
Adds a `create-release` job to `python-publish.yml` that runs after
`publish-to-pypi` succeeds and creates a GitHub Release with body
extracted from the corresponding CHANGELOG.md section.
Eliminates the manual `gh release create` step every release. The
recent v0.2.1 release exposed this gap — PyPI got the new package
but no GitHub Release was created automatically; the release was
backfilled by hand.
Mirrors the same pattern shipped in cycles-client-python PR #57:
- Triggered by tag push only (not manual workflow_dispatch
republishes).
- Extracts the CHANGELOG section between `## [VERSION]` and the
next `## [` heading using a portable string-based awk script
(no regex escaping issues across awk variants).
- If no CHANGELOG entry is found for the version, falls back to a
generic "see commit history" body — does not fail the job.
- Title is the tag name (e.g. `v0.2.2`); descriptive suffix on
prior releases is convention, the user can edit titles after
the fact.
- `prerelease: ${{ contains(github.ref_name, '-') }}` flags any
tag with a hyphen (e.g. `v0.3.0-rc.1`) as prerelease
automatically.
Pinned action SHAs match other repos in the org:
- softprops/action-gh-release@b430933... (v3.0.0)
- actions/checkout@de0fac2... (v6, matches existing job)
Tested locally — extraction produces clean body for v0.2.1 (no
heading bleed, no next-version boundary).
After this lands, future releases collapse to one step:
`git tag vX.Y.Z && git push origin vX.Y.Z`. PyPI publish + GitHub
Release both happen automatically.
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.
Summary
Adds a
create-releasejob topython-publish.ymlthat runs afterpublish-to-pypisucceeds and creates a GitHub Release with body extracted from the correspondingCHANGELOG.mdsection.Eliminates the manual
gh release createstep every release. The recent v0.2.1 release exposed this gap — PyPI got the new package but no GitHub Release was created automatically; the release was backfilled by hand.How it works
v*) triggers the workflow as before —build→publish-to-pypi.create-releaseruns after PyPI publish succeeds (only on tag push, not on manualworkflow_dispatch).softprops/action-gh-release@v3.0.0with the extracted body.Mirrors the same fix shipped in cycles-client-python PR #57
Same pattern, same action SHAs, same awk script. Tested locally on this repo's
CHANGELOG.md:## [0.2.1]and## [0.2.0], no heading bleed"Release v9.9.9. See commit history for changes."— does not fail the jobEdge cases handled
v0.3.0-rc.1) → auto-detected viacontains(github.ref_name, '-'), marked as prerelease in GitHub.workflow_dispatch→create-releaseskipped (only runs on tag push).Permissions
contents: readpreserved at workflow level.contents: writegranted only on thecreate-releasejob.Action SHAs (pinned)
softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda(v3.0.0)actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd(v6, matches existing job)Test plan
v*tag is pushed, the workflow should publish to PyPI AND create a GitHub Release with the corresponding CHANGELOG section as the body.Same fix candidates elsewhere in the org
cycles-client-python— already done (PR #57)cycles-openai-agents— this PRcycles-spring-boot-starter— itspublish.yamlalready creates a GitHub Release as part of the workflow chain (different shape; no fix needed there)cycles-client-typescript,cycles-openclaw-budget-guard— both have areleasejob in theirci.ymlalready