Skip to content

🤖 ci: publish to PyPI with trusted publishing - #64

Merged
dancergraham merged 1 commit into
mainfrom
ci/trusted-publishing
Nov 22, 2026
Merged

dancergraham merged 1 commit into
mainfrom
ci/trusted-publishing

Conversation

@dancergraham

Copy link
Copy Markdown
Owner

Re-opens #63, which GitHub closed when its base branch (ci/test-built-wheels, #62) was deleted after merging. Same branch and commit, now targeting main.

Replaces the token-based release job with two jobs:

  • attest (tag or workflow_dispatch): build-provenance attestation as before. Permissions: id-token and attestations: write only. Drops contents: write, which nothing used.
  • publish (tags only, needs attest): environment: pypi, id-token: write only, pypa/gh-action-pypi-publish v1.14.3 pinned by SHA, skip-existing: true as before. The action also uploads PEP 740 attestations to PyPI.

Artifacts are downloaded with pattern: wheels-* and merge-multiple, so only wheels and the sdist are attested and uploaded.

Before tagging a release:

  • The pypi environment allows only tags matching v*. Existing tags have no prefix (0.2.3), so tag the next release v0.x.y, or change the rule to [0-9]*. A non-matching tag fails at publish with a deployment-protection error; nothing is uploaded.
  • After the first successful trusted publish, delete the PYPI_API_TOKEN repo secret and revoke the token on PyPI.

Not verifiable before a real tag: the PyPI-side publisher config (owner dancergraham, repo e57-python, workflow CI.yml, environment pypi) has to match exactly.

Verified locally: zizmor reports no findings, actionlint is clean, and no workflow references secrets.* any more.

🤖 Generated with Claude Code

Replace the API-token upload with pypa/gh-action-pypi-publish in a
publish job bound to the pypi environment, so PyPI only accepts OIDC
tokens from that environment and its deployment rules gate which tags
publish. Split attestation into its own job and drop the unused
contents: write permission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dancergraham
dancergraham marked this pull request as ready for review November 22, 2026 14:08
@dancergraham
dancergraham merged commit 8fdd992 into main Nov 22, 2026
46 checks passed
@dancergraham
dancergraham deleted the ci/trusted-publishing branch November 22, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant