Release
Maintainer guide to bump, tag, and publish mrjk.clak to PyPI.
Overview
| Step | Command |
|---|---|
| Preview | task pre-release-show / task release-show / task changelog-show |
| Bump + changelog + commit + tag | task pre-release / task release |
| Push | task release-push (git push --follow-tags) |
| Publish | Release workflow on v* tags (or task publish_pypi manually) |
| All of the above from GitHub | Actions → Release → Run workflow (details) |
Releases are driven by commitizen
(config: [tool.commitizen] in pyproject.toml). One cz bump call:
- Computes the next version from the commits since the last tag (commit convention)
- Writes it to
pyproject.tomlanduv.lock(version_provider = "uv") - Prepends a generated section to
CHANGELOG.md - Commits
bump: version vX.Y.Zand creates the annotated tagvX.Y.Z
Version lives only in pyproject.toml. clak.__version__ is read on first
access from installed package metadata (importlib.metadata.version("mrjk.clak")).
Pushing a v* tag runs the Release workflow (.github/workflows/release.yml):
test gate, then task publish_pypi. Requires a GitHub environment named pypi with secret
PYPI_TOKEN (PyPI API token).
Prerequisites
- Clean git working tree (commitizen refuses to bump otherwise; untracked files are fine)
- uv project deps on the daily Python 3.12 env (in-project
.venv/viauv sync; commitizen is in thedevgroup) - Stable releases: checkout
mainormaster - Pre-releases: any branch except
main/master(usuallydevelop) - For CI publish: GitHub environment
pypi+ secretPYPI_TOKEN - For local/manual publish: a PyPI API token (
UV_PUBLISH_TOKEN)
Supported runtime range for users: Python 3.10–3.13; 3.14 should work but is not officially supported yet (see Development setup).
Typical flows
Next pre-release on develop
task pre-release-show # check the proposed version and changelog section
task pre-release # e.g. 0.7.0a2 -> 0.7.0a3
task release-push # CI publishes on the v* tag
Pre-release phases (a → b → rc):
Phases only move forward: once on b, task pre-release (alpha) keeps bumping
the beta number.
Stable release
git checkout main && git pull
task release-show
task release # e.g. 0.7.0rc1 -> 0.7.0, or 0.7.0 -> 0.7.1 / 0.8.0
task release-push
The increment is detected from the commits (see below). Override it with
task release -- --increment PATCH|MINOR|MAJOR.
Explicit version
uv run cz bump 0.7.0a2 # version + commit + tag, CHANGELOG untouched
uv run cz bump --changelog 0.7.0a2 # same, with a generated changelog section
Release from GitHub
Actions → Release → Run workflow (.github/workflows/release.yml) does the
same from a button. The branch picks the mode:
| Input | Default | Meaning |
|---|---|---|
| Use workflow from | – | main/master → stable release; any other branch (usually develop) → pre-release |
dry_run |
on | Bump, build, and show the next version and changelog section in the run summary; tests are skipped, nothing is pushed or published |
phase |
alpha |
Pre-release phase (alpha, beta, rc); phases only move forward; ignored on main/master |
increment |
auto |
Override the increment detected from commits (PATCH, MINOR, MAJOR) |
Jobs
- Test (skipped on dry run): full test gate, reused from the CI workflow (
ci.yml, Python 3.10–3.13) - Bump and Tag (button only):
cz bumpon the runner,uv build(uploaded as thedist-vX.Y.Zartifact), run summary; if not a dry run, pushes the commit and tag together (git push --atomic) - Publish to PyPI (skipped on dry run): checks out the tag and publishes it to
PyPI (
pypienvironment,PYPI_TOKEN)
On a v* tag push, only Test and Publish to PyPI run.
Notes:
- Tags pushed by the button do not start a second Release run (GitHub does
not start workflows from
GITHUB_TOKENpushes), so nothing is published twice. If Publish to PyPI fails after the push, use Re-run failed jobs on that run: it checks out the same tag. - If
mainis protected (branch protection or ruleset), allow GitHub Actions to bypass it, or the push is rejected. - After a stable release on
main, mergemainback intodevelop; otherwise the next pre-release starts from the old version indevelop'spyproject.toml. - Release notes: if
CHANGELOG.mdhas a hand-written## Unreleasedsection, the workflow and the local tasks rename it to## v<next> (<date>)and bump without--changelog, so the section is kept as written. Without one,cz bump --changeloggenerates the section from commits.
Commit messages
Commits follow Conventional Commits:
type(scope): subject, with an optional ! for breaking changes
(refactor(views)!: ..., or a BREAKING CHANGE: footer).
| Type | Changelog section | Version bump (pre-1.0) |
|---|---|---|
feat |
Added | minor |
fix |
Fixed | patch |
refactor |
Changed | patch |
perf |
Performance | patch |
! / BREAKING CHANGE: footer |
under its own type | minor (major_version_zero) |
docs, test, build, ci, chore, style |
not listed | none |
Use the scope for the area instead of a custom type: feat(views):,
fix(help):, test:, build(taskfile):. Commits with other types are
ignored by the changelog and by the version detection.
task hooks-install adds a commit-msg git hook that rejects messages that
do not follow the format (cz check).
Changelog
CHANGELOG.md is updated incrementally: each bump adds a section above the
latest one and leaves the rest of the file untouched. Releases up to
v0.7.0a2 were written by hand.
To add prose (upgrade notes, highlights) to a generated section, edit it right after the bump, before pushing:
task pre-release
$EDITOR CHANGELOG.md
git commit --amend --no-edit CHANGELOG.md
git tag -f -a -m "vX.Y.Z" vX.Y.Z # move the tag to the amended commit
task release-push
PyPI authentication
CI (default)
Configure once in the GitHub repo:
- Environment:
pypi - Environment secret (not a variable):
PYPI_TOKEN - Value: a PyPI API token from
pypi.org/manage/account/token
(must start with
pypi-; not a password; not a TestPyPI token)
On v* tag push, the workflow exports it as UV_PUBLISH_TOKEN and runs
task publish_pypi (uv build + uv publish).
If publish fails with 403 Invalid or non-existent authentication information,
the secret is usually missing/empty, misnamed, stored as a variable, or not a
live pypi-… token for pypi.org.
Local / manual
If you see HTTP 403 / access denied, the token is missing or revoked.
TestPyPI
task publish_pypi_test publishes to the testpypi index declared in
pyproject.toml ([[tool.uv.index]]). You still need a token: