Skip to content

Upgrade PyPI CI publishing to use Trusted Publishing#2270

Merged
larrybradley merged 1 commit into
astropy:mainfrom
lmmx:trusted-publishing
May 11, 2026
Merged

Upgrade PyPI CI publishing to use Trusted Publishing#2270
larrybradley merged 1 commit into
astropy:mainfrom
lmmx:trusted-publishing

Conversation

@lmmx

@lmmx lmmx commented May 2, 2026

Copy link
Copy Markdown
Contributor

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.

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/photutils/settings/publishing/

  • Owner: astropy
  • Repo: photutils
  • 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 @larrybradley + @astrofrog)

Closes #2250

@larrybradley larrybradley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @lmmx!

@larrybradley larrybradley merged commit af5a47c into astropy:main May 11, 2026
41 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REL/SEC: enabling trusted publishing for PyPI

2 participants