👷 ci(release): wire up towncrier-driven release pipeline#74
Merged
Conversation
The news fragments under docs/changelog/ were never consumed because the project shipped only the PyPI publish workflow without the towncrier config, template, rolled-up changelog, or release script that drives them. Tags were being cut by hand and the urls.Changelog link pointed at GitHub auto-generated notes, leaving the .rst fragments as dead weight. Port the full pipeline from tox-dev/tox so a release is a single workflow_dispatch click: prepare-release.yaml computes the next version (auto-detects major/minor/patch from breaking/feature fragment counts), then tox -e release runs tasks/release.py which calls towncrier build, commits the assembled docs/changelog.rst, tags, force-pushes main, and opens the GitHub release. The existing tag-push release.yaml handles PyPI publishing unchanged. docs/changelog.rst is backfilled for 1.0.0 through 1.3.0 from git history so the rendered changelog is a single source of truth rather than splitting history between Sphinx and GitHub Releases. The 65.feature.rst fragment is dropped because it already shipped in 1.3.0 via PR #71 and would otherwise double-count on the next release. The sphinxcontrib-towncrier extension renders unreleased fragments as a draft section in the docs.
ty rejected gitpython's loose runtime polymorphism in tasks/release.py: set_tracking_branch was being passed a generic Reference, delete_tag and create_tag were getting a Version object where TagReference and str were expected, and Commit was being passed where SymbolicReference|str fits. The previous commit shipped # ty: ignore directives, which is the wrong shape of fix — it silences the checker rather than producing correct types and also caused unused-ignore warnings on Linux. Address each call site with the typed equivalent: look up the remote branch via upstream.refs[branch_name], stringify the version for tag names, look up the existing tag via repo.tags[version_str] before deleting, and pass release_commit.hexsha as the create_tag ref. Wire gitpython and packaging into the type-3.8/type-3.14 tox envs so ty can resolve their imports in CI.
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.
The news fragments under
docs/changelog/were never consumed because the project shipped the PyPI publish workflow without the towncrier config, template, rolled-up changelog, or release script that drives them. Tags were being cut by hand andurls.Changelogpointed at GitHub auto-generated notes, leaving the.rstfragments as dead weight that risked double-counting on every release.This ports the full release pipeline from
tox-dev/tox. A release is now a singleworkflow_dispatchclick:prepare-release.yamlcomputes the next version (auto-detecting major/minor/patch frombreaking/featurefragment counts), thentox -e releaserunstasks/release.py, which invokestowncrier build, commits the assembleddocs/changelog.rst, tags, force-pushesmain, and opens the GitHub release. The existing tag-pushrelease.yamlhandles PyPI publishing unchanged. 🚀docs/changelog.rstis backfilled for 1.0.0 through 1.3.0 from git history so the rendered changelog is a single source of truth rather than splitting between Sphinx and GitHub Releases. The65.feature.rstfragment is dropped because that work already shipped in 1.3.0 via PR #71.sphinxcontrib-towncrierrenders unreleased fragments as a draft section in the Sphinx build.Operationally, this requires a
RELEASE_PATsecret and arelease-authGitHub environment, both used by the newprepare-release.yamlworkflow.