Skip to content

Commit 34c21dd

Browse files
committed
pypi: use trusted publishing for binary wheels
1 parent f8030d0 commit 34c21dd

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

.github/workflows/ci-wheels.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ jobs:
129129
needs: test-wheel
130130
name: "publish to test.pypi"
131131
runs-on: ubuntu-latest
132+
permissions:
133+
id-token: write # Mandatory for PyPI Trusted Publishing OpenID Connect (OIDC)
134+
environment: test-pypi
135+
132136
# upload to Test PyPI for every commit on main branch
133137
# and check for the SciTools repo
134138
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'SciTools'
@@ -138,18 +142,20 @@ jobs:
138142
name: pypi-artifacts
139143
path: ${{ github.workspace }}/dist
140144

141-
- uses: pypa/gh-action-pypi-publish@release/v1
145+
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
142146
with:
143-
user: __token__
144-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
145-
repository_url: https://test.pypi.org/legacy/
146-
skip_existing: true
147-
print_hash: true
147+
repository-url: https://test.pypi.org/legacy/
148+
skip-existing: true
149+
print-hash: true
148150

149151
publish-artifacts-pypi:
150152
needs: test-wheel
151153
name: "publish to pypi"
152154
runs-on: ubuntu-latest
155+
permissions:
156+
id-token: write # Mandatory for PyPI Trusted Publishing OpenID Connect (OIDC)
157+
environment: pypi
158+
153159
# upload to PyPI for every tag starting with 'v'
154160
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && github.repository_owner == 'SciTools'
155161
steps:
@@ -158,8 +164,6 @@ jobs:
158164
name: pypi-artifacts
159165
path: ${{ github.workspace }}/dist
160166

161-
- uses: pypa/gh-action-pypi-publish@release/v1
167+
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
162168
with:
163-
user: __token__
164-
password: ${{ secrets.PYPI_API_TOKEN }}
165-
print_hash: true
169+
print-hash: true

0 commit comments

Comments
 (0)