Skip to content

IT-6150: switch PyPI publishing to trusted publishing (OIDC)#375

Draft
jychuah wants to merge 1 commit into
mainfrom
it-6150-trusted-publishing
Draft

IT-6150: switch PyPI publishing to trusted publishing (OIDC)#375
jychuah wants to merge 1 commit into
mainfrom
it-6150-trusted-publishing

Conversation

@jychuah

@jychuah jychuah commented Jul 24, 2026

Copy link
Copy Markdown

Part of IT-6150 — move PyPI release uploads to GitHub Actions OIDC trusted publishing, removing the long-lived PYPI_USERNAME / PYPI_PASSWORD token from repo secrets.

What changed (.github/workflows/publish-on-pypi.yml)

  • Added permissions: id-token: write (required for OIDC).
  • Added environment: pypi (must match the Environment field in the PyPI trusted-publisher config).
  • Replaced the twine upload step — which used secrets.PYPI_USERNAME / secrets.PYPI_PASSWORD — with pypa/gh-action-pypi-publish (pinned to v1.14.1).
  • Kept twine check --strict as its own step.

⚠️ DO NOT MERGE YET — ordering matters

This workflow only authenticates after a trusted publisher is configured on the PyPI project. Because this PR removes the token auth, merging it before PyPI is configured will break the next release.

Required order:

  1. IT configures the trusted publisher on PyPI: owner enthought, this repository, workflow filename publish-on-pypi.yml, environment pypi.
  2. Cut a validation release / re-run the workflow and confirm the OIDC upload succeeds.
  3. Then merge this PR.

Kept as a draft until step 1 is done. /cc @mdickinson

Replace token-based twine upload with pypa/gh-action-pypi-publish using
GitHub Actions OIDC. Adds id-token: write permission and the pypi
environment; removes the PYPI_USERNAME/PYPI_PASSWORD secrets usage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jychuah
jychuah requested a review from mdickinson July 24, 2026 16:02
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