Skip to content

Commit a0614ef

Browse files
committed
fix: add OIDC permissions and remove API tokens
- Add id-token: write permissions for trusted publishing - Remove API token references in favor of OIDC - Fixes PyPI publishing authentication
1 parent 2729008 commit a0614ef

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ jobs:
6666
runs-on: ubuntu-latest
6767
if: (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'test') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
6868
environment: test-pypi
69+
permissions:
70+
id-token: write
71+
contents: read
6972
steps:
7073
- name: Download build artifacts
7174
uses: actions/download-artifact@v4
@@ -77,7 +80,6 @@ jobs:
7780
uses: pypa/gh-action-pypi-publish@release/v1
7881
with:
7982
repository-url: https://test.pypi.org/legacy/
80-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
8183

8284
- name: Test installation from Test PyPI
8385
run: |
@@ -90,6 +92,9 @@ jobs:
9092
runs-on: ubuntu-latest
9193
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production'
9294
environment: production-pypi
95+
permissions:
96+
id-token: write
97+
contents: read
9398
steps:
9499
- name: Download build artifacts
95100
uses: actions/download-artifact@v4
@@ -99,8 +104,6 @@ jobs:
99104

100105
- name: Publish to PyPI
101106
uses: pypa/gh-action-pypi-publish@release/v1
102-
with:
103-
password: ${{ secrets.PYPI_API_TOKEN }}
104107

105108
create-release:
106109
needs: [build, deploy-production]

0 commit comments

Comments
 (0)