Skip to content

👷 ci(release): wire up towncrier-driven release pipeline#74

Merged
gaborbernat merged 2 commits into
mainfrom
feat/towncrier-release-pipeline
May 12, 2026
Merged

👷 ci(release): wire up towncrier-driven release pipeline#74
gaborbernat merged 2 commits into
mainfrom
feat/towncrier-release-pipeline

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

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 and urls.Changelog pointed at GitHub auto-generated notes, leaving the .rst fragments 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 single workflow_dispatch click: prepare-release.yaml computes the next version (auto-detecting major/minor/patch from breaking/feature fragment counts), then tox -e release runs tasks/release.py, which invokes 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 between Sphinx and GitHub Releases. The 65.feature.rst fragment is dropped because that work already shipped in 1.3.0 via PR #71. sphinxcontrib-towncrier renders unreleased fragments as a draft section in the Sphinx build.

Operationally, this requires a RELEASE_PAT secret and a release-auth GitHub environment, both used by the new prepare-release.yaml workflow.

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.
@gaborbernat gaborbernat added the enhancement New feature or request label May 12, 2026
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.
@gaborbernat gaborbernat merged commit 6840c41 into main May 12, 2026
16 checks passed
@gaborbernat gaborbernat deleted the feat/towncrier-release-pipeline branch May 12, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant