Skip to content

Commit eb1c950

Browse files
Apply cookie rule GH105
GitHub Actions: └── GH105 Use Trusted Publishing instead of token-based publishing on PyPI ❌
1 parent 83e6c49 commit eb1c950

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/wheel.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,37 @@ jobs:
8686
8787
upload_pypi:
8888
needs: [build_wheels, build_sdist]
89+
environment: pypi
90+
permissions:
91+
id-token: write
92+
attestations: write
93+
contents: read
8994
runs-on: ubuntu-latest
9095
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
9196
steps:
92-
- uses: actions/download-artifact@v6
97+
- uses: actions/download-artifact@v8
9398
with:
9499
name: sdist
95100
path: dist
96-
- uses: actions/download-artifact@v6
101+
- uses: actions/download-artifact@v8
97102
with:
98103
pattern: wheels-*
99104
path: dist
100105
merge-multiple: true
101106

102-
- uses: pypa/gh-action-pypi-publish@master
107+
- name: Generate artifact attestations
108+
uses: actions/attest-build-provenance@v4
103109
with:
104-
user: __token__
105-
password: ${{ secrets.pypi_password }}
106-
# To test: repository_url: https://test.pypi.org/legacy/
110+
subject-path: "dist/*"
111+
112+
- uses: pypa/gh-action-pypi-publish@release/v1
107113

108114
upload_nightly:
109115
needs: [build_wheels]
110116
runs-on: ubuntu-latest
111117
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
112118
steps:
113-
- uses: actions/download-artifact@v6
119+
- uses: actions/download-artifact@v8
114120
with:
115121
pattern: wheels-*
116122
path: dist

0 commit comments

Comments
 (0)