Releasing agent-action-capsule to PyPI
September 8, 2026 · View on GitHub
Publishing is automated by .github/workflows/release.yml via PyPI's OIDC
Trusted Publishing — no API token is stored in this repo. The workflow:
- On any push to a
releaseevent,workflow_dispatch, or a pushed tag it builds the sdist + wheel frompython/and runstwine check(thebuildjob). This always runs and never uploads — it is the dry run. - Only when the trigger is a published GitHub Release, the
publishjob runs, requests a short-lived OIDC token viaid-token: write, and uploads throughpypa/gh-action-pypi-publish.
One-time PyPI configuration (Steven — not done by this workflow)
Before the first real publish, configure a Trusted Publisher on PyPI:
- Log in to https://pypi.org as the
agent-action-capsuleproject owner.- If the project does not exist on PyPI yet, use https://pypi.org/manage/project/create-trusted-publisher/ to pre-register a publisher for a project name that doesn't exist yet ("pending publisher"); the first successful publish then claims it.
- If the project already exists, go to Project → Settings → Publishing and add a new publisher there.
- Fill in:
Field Value PyPI project name agent-action-capsuleOwner action-state-groupRepository name agent-action-capsuleWorkflow filename release.ymlEnvironment name pypi - In the GitHub repo, create an Actions environment named
pypi(Settings → Environments) soenvironment: pypiin the workflow resolves. Optionally add required reviewers on that environment for an extra gate before any publish job runs.
No secret or token needs to be added anywhere — Trusted Publishing exchanges the workflow's OIDC identity for a one-time upload credential at publish time.
Cutting a release
- Bump
versioninpython/pyproject.toml. - Tag and publish a GitHub Release from that commit. The
publishjob runs only for therelease: publishedtrigger, so a plain tag push or a manually runworkflow_dispatchbuild the package but do not upload it. - Confirm the run's
publishjob succeeded and the new version is live at https://pypi.org/project/agent-action-capsule/.