Skip to content

Upgrade PyPI CI publishing to use Trusted Publishing#661

Open
lmmx wants to merge 1 commit intoastropy:mainfrom
lmmx:trusted-publishing
Open

Upgrade PyPI CI publishing to use Trusted Publishing#661
lmmx wants to merge 1 commit intoastropy:mainfrom
lmmx:trusted-publishing

Conversation

@lmmx
Copy link
Copy Markdown

@lmmx lmmx commented May 2, 2026

Migrates PyPI publishing from a long-lived API token to Trusted Publishing (OIDC), motivated by recent supply chain attacks (litellm, lightning).

The publishing step uses a reusable workflow from the OpenAstronomy org, and since you can't pass OIDC tokens across orgs, the workaround (documented here) is to instead set upload_to_pypi: false and save_artifacts: true then publish the stored artifact with the pypa/gh-action-pypi action. I followed this example from the astropy package repo.

The code changes here require some further (trivial) setup on the PyPI-side. Specifically, the PyPI admin (not just maintainer) needs to register the TP on PyPI at https://pypi.org/manage/project/regions/settings/publishing/

  • Owner: astropy
  • Repo: regions
  • Workflow: publish.yml
  • Environment: pypi

The pypi_token secret should be deleted from the repo secrets and can be invalidated on PyPI too.

(Not sure who is the PyPI admin, the maintainers are listed as @keflavich @larrybradley @astrofrog)

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