D70 — A GitHub release publishes analects to PyPI by trusted publishing¶
- Status: Accepted — amends D65 (how the tool is installed)
- Date: 2026-11-23
- Origin: reserving the name
analectson PyPI - Area: build
Decision¶
- The package is on PyPI as
analects. The name is held by a placeholder, 0.0.1, uploaded by hand to reserve it. Every later version is published by CI. - A GitHub release publishes it. Publishing a release whose tag is
v<version>, matchingversioninpyproject.toml, runs.github/workflows/release.yml. The workflow refuses a tag that doesn't match. It then runs the tests,analects schema testand the release check, builds the wheel and sdist, and uploads them. - No token is stored. PyPI trusts one publisher: the repository
KindTechUK/analects, the workflowrelease.ymland the GitHub environmentpypi. The publish job gets a short-lived OIDC token from GitHub and nothing else, so no PyPI token is kept in the repository's secrets or on anyone's machine.
Why¶
The name had to be reserved before the public release (D65): kg is held by an
unrelated tool on PyPI (D69), and an unclaimed analects could have gone the same
way. A token kept in CI secrets can be leaked or outlive the person who made it.
A trusted publisher can only be used by the named workflow, in the named
repository.
Alternatives¶
- An API token in the repository's secrets. It works anywhere, but it is a long-lived credential that someone has to rotate. PyPI recommends trusted publishing instead.
- Publishing by hand with
uv publish. No tests run first, and a release depends on whose laptop it comes from. - Publishing on every tag push. Pushing a tag is easy to do by mistake. A GitHub release is a deliberate step and carries its notes.