Skip to content

ci: publish to PyPI with trusted publishing instead of PYPI_TOKEN - #1148

Draft
alexb-openrouter wants to merge 1 commit into
mainfrom
devin/1793075644-pypi-oidc
Draft

alexb-openrouter wants to merge 1 commit into
mainfrom
devin/1793075644-pypi-oidc

Conversation

@alexb-openrouter

Copy link
Copy Markdown
Contributor

Summary

Moves PyPI publishing of openrouter from the long-lived PYPI_TOKEN to PyPI trusted publishing (OIDC).

  • .speakeasy/workflow.yaml: publish.pypi.token: $pypi_token → publish.pypi.useTrustedPublishing: true. sdk-gen-config supports this flag, and the pinned Speakeasy CLI is 1.787.0.
  • With the flag set, the pinned reusable sdk-publish.yaml@68f3bfe sets output use_pypi_trusted_publishing=true and skips its token-based publish-pypi job. It does not upload on its own, so sdk_publish.yaml gets a caller-side publish-pypi job. That job uses Speakeasy's own publish-pypi composite action at the same pin, which runs uv publish --trusted-publishing always dist/*. This matches the job that speakeasy configure publishing generates.
  • The new job gets only contents: read and id-token: write. The workflow-level permissions moved onto the publish job, with permissions: {} at the top, so the OIDC token is not available to other jobs. zizmor reports no new findings.
  • Removed pypi_token from all three workflows. The generation workflows run mode: pr and never publish.

Before merge (needs a PyPI owner of openrouter): go to pypi.org → openrouter → Publishing → add a GitHub trusted publisher: owner OpenRouterTeam, repo python-sdk, workflow sdk_publish.yaml, no environment. PyPI accepts tokens and OIDC side by side, so you can add the publisher at any time before merging.

After the first OIDC release succeeds: revoke the PyPI token and delete the PYPI_TOKEN repo secret.

Not verified until a real release: the end-to-end upload, which can't be exercised from a PR. scripts/publish.sh still references $PYPI_TOKEN, but it is a Speakeasy-generated file (tracked in gen.lock) and nothing calls it any more.

Link to Devin session: https://openrouter.devinenterprise.com/sessions/ab9f8df32f544a1eae4412b551a5f4b4
Open in Devin Desktop: https://openrouter.devinenterprise.com/desktop/session/ab9f8df32f544a1eae4412b551a5f4b4?variant=devin
Requested by: @alexb-openrouter

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from Alex

SYSTEM:
<latest_message>
Alex Bujduveanu (U0BFFJD2XR8) [ts=1793074025.888729]: can this change be done entirely in a PR without git config chnages outside the PR?

publish tokens are long-lived. release.yaml publishes to npm with NPM_TOKEN, typescript-sdk uses NPM_TOKEN, python-sdk uses PYPI_TOKEN. litellm got hit in March because a token like this was readable from shared CI. fix: npm/PyPI trusted publishing (OIDC). ai-sdk-provider already does this.
</latest_message>

=== BEGIN THREAD HISTORY ===
Alex Bujduveanu (U0BFFJD2XR8) [ts=1793074025.888729]: can this change be done entirely in a PR without git config chnages outside the PR?

publish tokens are long-lived. release.yaml publishes to npm with NPM_TOKEN, typescript-sdk uses NPM_TOKEN, python-sdk uses PYPI_TOKEN. litellm got hit in March because a token like this was readable from shared CI. fix: npm/PyPI trusted publishing (OIDC). ai-sdk-provider already does this.
=== END THREAD HISTORY ===
Channel ID: D0BFEN3DLHK
Thread URL: https://openrouter.slack.com/archives/D0BFEN3DLHK/p1793074025888729?thread_ts=1793074025.888729&amp;cid=D0BFEN3DLHK

The <latest_message> is the message that you should use to guide your goals + task for this session, and you should use the rest of the slack thread as context.
A [ts=...] marker on a Slack message is that message's timestamp. To act on a specific message with the slack tool (e.g. adding an emoji reaction via the reaction command), pass that value as timestamp along with the Channel ID — no extra lookup call is needed.

This branch has not been deployed

No deployments
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