Skip to content

Commit c5b6ee1

Browse files
committed
Switch to PyPI trusted publishers (OIDC) for secure publishing
- Replace API token authentication with OpenID Connect - Use pypa/gh-action-pypi-publish action - Add id-token: write permission for OIDC - More secure than storing API tokens in secrets
1 parent bd39310 commit c5b6ee1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ jobs:
5252
needs: test
5353
runs-on: ubuntu-latest
5454
if: github.event_name == 'release' && github.event.action == 'published'
55+
permissions:
56+
id-token: write # Required for OIDC authentication
57+
contents: read
5558

5659
steps:
5760
- uses: actions/checkout@v4
@@ -64,14 +67,11 @@ jobs:
6467
- name: Install build tools
6568
run: |
6669
python -m pip install --upgrade pip
67-
pip install build twine
70+
pip install build
6871
6972
- name: Build package
7073
run: python -m build
7174

7275
- name: Publish to PyPI
73-
run: twine upload dist/*
74-
env:
75-
TWINE_USERNAME: __token__
76-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
76+
uses: pypa/gh-action-pypi-publish@release/v1
7777

0 commit comments

Comments
 (0)