Repository navigation
Conversation
The release workflow uploaded to PyPI with a long-lived PYPI_API_TOKEN secret. Switch it to PyPI trusted publishing (OIDC), so the workflow gets a short-lived token for each release and no secret is stored. The single release job is split into build, publish and GitHub release jobs. Only the publish job gets an OIDC token, and it runs in the `pypi` environment so each publish needs a reviewer's approval. Also replace the deprecated `::set-output` command with $GITHUB_OUTPUT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Publish with the PYPI_API_TOKEN secret unless the PYPI_TRUSTED_PUBLISHING repository variable is `true`. Releases keep working if this merges before the trusted publisher exists on PyPI, and switching over is a settings change rather than another PR. The token path will be removed once a release has gone through with trusted publishing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tinaxcodes
approved these changes
Dec 3, 2026
Drop the PYPI_TRUSTED_PUBLISHING variable. The publish step now passes the PYPI_API_TOKEN secret directly, so releases use the token while the secret exists and trusted publishing once it is deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changed
The release workflow (
.github/workflows/release.yml) can now publishonepasswordconnectsdkto PyPI with PyPI trusted publishing (OIDC) instead of the long-livedPYPI_API_TOKENsecret. It keeps the token as a fallback until trusted publishing is set up.The trigger is unchanged: the workflow still runs when a
release/*PR is merged intomain. The singlereleasejob is split into three:build(read-only): runspoetry buildand uploadsdist/as an artifact.publish: the only job withid-token: write. It runs in thepypienvironment and uploads the build job's files. It runs no code from the repo.PYPI_API_TOKENas the password. While the secret is set, it uploads with the token, as today. Once the secret is deleted, the password is empty, so the action uses the job's OIDC token and attaches attestations.release(contents: write): creates the tag and GitHub release, the same as before.It also replaces the deprecated
::set-outputcommand with$GITHUB_OUTPUT.Why
Anyone holding the
PYPI_API_TOKEN(set in 2021) can publish a package under our name. Trusted publishing removes the token, and the environment puts every publish behind a review.The fallback means this can merge before anyone has access to the PyPI project. Releases keep working on the token until the secret is deleted. Switching over is a settings change, not another PR.
Rollout
pypienvironment. Require review from1Password/open-source, turn on "Prevent self-review", and add no secrets. For deployment branches, use the same rules asconnect-sdk-js, which has the same merged-release-PR trigger:main,betaandrelease/*. If a release runs before the environment exists, GitHub creates it with no protection rules, and the token upload still works.onepasswordconnectsdkproject (Manage → Publishing) with owner1Password, repositoryconnect-sdk-python, workflowrelease.ymland environmentpypi.PYPI_API_TOKENrepository secret (Settings → Secrets and variables → Actions). Make sure the token is saved in 1Password first: re-adding the secret is the rollback.password:line.Don't do step 4 before step 3. With no secret and no trusted publisher, the publish fails at the OIDC exchange and nothing is uploaded.
Notes for reviewers
pull_requesttrigger aren't proven yet. GitHub matches environment branch rules against the run's ref.connect-sdk-js's last release (v1.4.3) recorded its deployment against the head branchrelease/v1.4.3, which therelease/*rule covers. Its branch rules were only added after that release, though, so this hasn't been tested with them in place. If the first publish is rejected with "not allowed to deploy", the environment's branch rules are the place to look.main(commit: main), as before.🤖 Generated with Claude Code