Skip to content

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

Closed
dancergraham wants to merge 1 commit into
ci/test-built-wheelsfrom
ci/trusted-publishing
Closed

dancergraham wants to merge 1 commit into
ci/test-built-wheelsfrom
ci/trusted-publishing

Conversation

@dancergraham

Copy link
Copy Markdown
Owner

Stacked on #62. Merge #62 first and delete its branch on merge so this PR retargets to main. Otherwise it repeats what happened to #61.

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 deleted the branch ci/test-built-wheels November 22, 2026 14:02
@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