Skip to content

feat: add PyPI trusted publishing support to workflows#286

Merged
danielkov merged 1 commit intomainfrom
feat/pypi-trusted-publishing-workflow
Feb 4, 2026
Merged

feat: add PyPI trusted publishing support to workflows#286
danielkov merged 1 commit intomainfrom
feat/pypi-trusted-publishing-workflow

Conversation

@danielkov
Copy link
Copy Markdown
Contributor

@danielkov danielkov commented Feb 4, 2026

Summary

  • Adds conditional support for PyPI trusted publishing (OIDC) in publish workflows
  • When use_pypi_trusted_publishing output is true, uses pypa/gh-action-pypi-publish with OIDC
  • Falls back to token-based twine upload when output is not set (backwards compatible)

Changes

  • Add id-token: write permission to publish-pypi jobs for OIDC support
  • Add package build step for trusted publishing path using python -m build
  • Add pypa/gh-action-pypi-publish@v1.12.4 step for OIDC publishing
  • Update existing publish steps to only run for token-based auth
  • Add use_pypi_trusted_publishing output definition to action.yml

Testing

This change is backwards compatible - when use_pypi_trusted_publishing output is not set, the existing token-based publishing path is used.

🤖 Generated with Claude Code

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>
@danielkov danielkov merged commit 92d881c into main Feb 4, 2026
2 checks passed
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)
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.

2 participants