Skip to content

Commit 4987f9e

Browse files
authored
use pypi trusted publishing (#425)
1 parent fa21375 commit 4987f9e

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

.github/workflows/ci-wheels.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ jobs:
103103
needs: [build_bdist, build_sdist]
104104
name: "Publish to Test PyPI"
105105
runs-on: ubuntu-latest
106+
permissions:
107+
id-token: write # Mandatory for PyPI Trusted Publishing OpenID Connect (OIDC)
108+
environment: test-pypi
106109
# upload to Test PyPI for every commit on main branch
107110
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
108111
steps:
@@ -111,10 +114,9 @@ jobs:
111114
merge-multiple: true
112115
path: ${{ github.workspace }}/dist
113116

114-
- uses: pypa/gh-action-pypi-publish@release/v1
117+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
115118
with:
116-
user: __token__
117-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
119+
118120
repository_url: https://test.pypi.org/legacy/
119121
skip_existing: true
120122
print_hash: true
@@ -124,6 +126,9 @@ jobs:
124126
needs: [build_bdist, build_sdist]
125127
name: "Publish to PyPI"
126128
runs-on: ubuntu-latest
129+
permissions:
130+
id-token: write # Mandatory for PyPI Trusted Publishing OpenID Connect (OIDC)
131+
environment: pypi
127132
# upload to PyPI for every tag starting with 'v'
128133
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
129134
steps:
@@ -132,8 +137,6 @@ jobs:
132137
merge-multiple: true
133138
path: ${{ github.workspace }}/dist
134139

135-
- uses: pypa/gh-action-pypi-publish@release/v1
140+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
136141
with:
137-
user: __token__
138-
password: ${{ secrets.PYPI_API_TOKEN }}
139142
print_hash: true

0 commit comments

Comments
 (0)