Skip to content

fix(CI): replace pypa/gh-action-pypi-publish with inline twine upload#933

Open
yangxk1 wants to merge 1 commit into
apache:mainfrom
yangxk1:fix-pypi-publish-action
Open

fix(CI): replace pypa/gh-action-pypi-publish with inline twine upload#933
yangxk1 wants to merge 1 commit into
apache:mainfrom
yangxk1:fix-pypi-publish-action

Conversation

@yangxk1

@yangxk1 yangxk1 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Reason for this PR

The pypa/gh-action-pypi-publish action is not in the Apache organization's GitHub Actions allowlist, causing the upload_test_pypi and upload_pypi jobs to fail with:

The actions pypa/gh-action-pypi-publish@release/v1 and pypa/gh-action-pypi-publish@release/2473ec6c6aa87f38946284d51289219fd0b87264 are not allowed in apache/incubator-graphar

See: https://github.com/apache/incubator-graphar/actions/runs/27183446921

What changes are included in this PR?

Replace both uses of pypa/gh-action-pypi-publish with inline shell steps that perform the same trusted publisher OIDC flow directly:

  1. Request an OIDC token from GitHub Actions (using the existing id-token: write permission)
  2. Exchange it with PyPI/TestPyPI for a short-lived API token via the _/oidc/mint-token endpoint
  3. Upload packages using twine

Additionally, ::add-mask:: is used to prevent the minted token from leaking in CI logs.

Are these changes tested?

The OIDC flow follows PyPI's official trusted publisher documentation. The workflow YAML has been validated for correct syntax. The actual upload will be tested when the workflow runs on the next push to main.

Are there any user-facing changes?

No. The publishing behavior is identical — packages are still uploaded via PyPI trusted publishing (OIDC). Only the CI implementation changes.

Checklist

  • I have performed a self-review of my own code.
  • I have formatted my own code using make cpplint before submitting when changed files are in the cpp directory.
  • I have performed pre-commit run before commit the changed files.
  • I have added tests to prove my changes are effective.

The pypa/gh-action-pypi-publish action is blocked by Apache org's
action allowlist policy. Replace it with inline shell steps that use
PyPI's trusted publisher OIDC flow directly: mint a short-lived API
token via the OIDC endpoint and upload with twine.

The id-token: write permission is preserved so GitHub Actions still
injects the OIDC credentials needed for the trusted publisher exchange.
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