feat: add PyPI trusted publishing support to workflows#286
Merged
Conversation
Add conditional support for PyPI trusted publishing (OIDC) in the publish workflows. When the `use_pypi_trusted_publishing` output is set to 'true', the workflow will use `pypa/gh-action-pypi-publish` with OIDC authentication instead of token-based twine upload. Changes: - Add `id-token: write` permission to publish-pypi jobs - Add build step for trusted publishing path - Add pypa/gh-action-pypi-publish step for OIDC publishing - Update existing publish steps to only run for token-based auth - Add `use_pypi_trusted_publishing` output to action.yml This change is backwards compatible - when the output is not set, the existing token-based publishing path is used. Co-Authored-By: Claude <noreply@anthropic.com>
TristanSpeakEasy
approved these changes
Feb 4, 2026
danielkov
added a commit
to speakeasy-api/speakeasy
that referenced
this pull request
Feb 4, 2026
## Summary
Adds instructions for configuring PyPI trusted publishing when users run
`speakeasy configure publishing` with a Python target that has
`useTrustedPublishing: true` configured.
## Changes
- Add `PyPITrustedPublishingConfig` struct
- Add `getPyPITrustedPublishingInstructions()` function that generates
user-facing instructions
- Update `configurePublishing()` to detect PyPI trusted publishing
configs and display setup instructions
- Update sdk-gen-config dependency to v1.47.1 (includes
`UseTrustedPublishing` field)
## Instructions Output
When a user has configured trusted publishing, they'll see:
```
• Configure trusted publishing for your PyPI package 'my-package':
◦ Navigate to https://pypi.org/manage/project/my-package/settings/publishing/
◦ Add a new 'trusted publisher' with the following configuration:
- Owner: my-org
- Repository name: my-repo
- Workflow name: sdk_publish.yaml
- Environment name: <Leave Blank>
• Navigate to https://github.com/my-org/my-repo/actions to regenerate and publish
• Your package will be published with attestations. Verify at https://pypi.org/project/my-package/#files
```
## Related PRs
- sdk-gen-config:
speakeasy-api/sdk-gen-config#115 (merged)
- sdk-generation-action:
speakeasy-api/sdk-generation-action#286 (merged)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
use_pypi_trusted_publishingoutput istrue, usespypa/gh-action-pypi-publishwith OIDCChanges
id-token: writepermission topublish-pypijobs for OIDC supportpython -m buildpypa/gh-action-pypi-publish@v1.12.4step for OIDC publishinguse_pypi_trusted_publishingoutput definition toaction.ymlTesting
This change is backwards compatible - when
use_pypi_trusted_publishingoutput is not set, the existing token-based publishing path is used.🤖 Generated with Claude Code