Publish to PyPI via AWS Secrets Manager (OIDC)#531
Merged
Conversation
The v12.1.0 release failed to upload because secrets.pypi_secret is no longer set on this repo (403 Forbidden, empty token). The dropbox/stone repo already migrated publishing off GitHub secrets to a PyPI token fetched from AWS Secrets Manager via GitHub OIDC; mirror that here. The role-to-assume and secret ARNs are placeholders scoped to this repo -- they must be provisioned for dropbox-sdk-python before the workflow can authenticate (stone's ARNs will not work, as the IAM trust policy is scoped to a single repo). Also adds workflow_dispatch so a maintainer can re-trigger the publish without cutting a new release.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #531 +/- ##
=======================================
Coverage 65.12% 65.12%
=======================================
Files 31 31
Lines 54897 54897
Branches 3902 3902
=======================================
Hits 35749 35749
Misses 18989 18989
Partials 159 159
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rhui-dbx
approved these changes
Jul 9, 2026
The role-to-assume used the wrong name: the provisioned role encodes both the org and the repo (dropbox / dropbox-sdk-python), so it is oidc-github-dropbox-dropbox-sdk-python-repo, not oidc-github-dropbox-sdk-python-repo. The old name would never resolve and the OIDC assume would fail. Also reference the PyPI secret by its friendly name instead of a full ARN. Secrets Manager appends a random suffix to the ARN, so the name is the stable identifier and avoids hardcoding a suffix that is not known until the secret is created.
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
The v12.1.0 publish (release #530 → tag
v12.1.0) built andtwine checked cleanly but failed at upload with403 Forbidden:secrets.pypi_secretis no longer configured on this repo, soTWINE_PASSWORDwas empty.dropbox/stonealready migrated its publishing off GitHub secrets to a PyPI token fetched from AWS Secrets Manager via GitHub OIDC. This PR mirrors that approach sodropbox-sdk-pythonpublishes the same way.Changes
.github/workflows/pypiupload.yml:permissions: id-token: writefor OIDC.aws-actions/configure-aws-credentials, then fetch the PyPI token withaws-actions/aws-secretsmanager-get-secrets.twine upload(replaces the emptysecrets.pypi_secret).workflow_dispatchso a maintainer can re-trigger publishing without cutting a new release.The
role-to-assumeandsecret-idsARNs are placeholders scoped to this repo and must be provisioned fordropbox-sdk-python:arn:aws:iam::082972943155:role/oidc-github-dropbox-sdk-python-repo— IAM role with a trust policy allowing this repo's OIDC subject (stone's role won't work; its trust policy is repo-scoped).arn:aws:secretsmanager:us-west-2:082972943155:secret:pypi-api-token-dropbox-sdk-python— Secrets Manager secret holding a PyPI API token scoped to thedropboxproject.Please confirm/adjust these ARNs to match what's provisioned.
Publishing v12.1.0 after merge
Tag
v12.1.0and its GitHub Release already exist; only the upload failed. Once this is merged and the AWS resources exist, publish via Actions → Publish to PyPi → Run workflow (workflow_dispatch), or re-run the failed release run.Refs #528