Skip to content

Commit 073a57f

Browse files
authored
use trusted publishers instead of a API token (#7899)
* use trusted publishers instead of a API token * same for TestPyPI
1 parent 0c876e4 commit 073a57f

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/pypi-release.yaml

+23-4
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,26 @@ jobs:
7070
python -m pip install dist/xarray*.whl
7171
python -m xarray.util.print_versions
7272
73+
upload-to-test-pypi:
74+
needs: test-built-dist
75+
if: github.event_name == 'push'
76+
runs-on: ubuntu-latest
77+
78+
environment:
79+
name: pypi
80+
url: https://test.pypi.org/p/xarray
81+
permissions:
82+
id-token: write
83+
84+
steps:
85+
- uses: actions/download-artifact@v3
86+
with:
87+
name: releases
88+
path: dist
7389
- name: Publish package to TestPyPI
7490
if: github.event_name == 'push'
7591
uses: pypa/[email protected]
7692
with:
77-
user: __token__
78-
password: ${{ secrets.TESTPYPI_TOKEN }}
7993
repository_url: https://test.pypi.org/legacy/
8094
verbose: true
8195

@@ -84,6 +98,13 @@ jobs:
8498
needs: test-built-dist
8599
if: github.event_name == 'release'
86100
runs-on: ubuntu-latest
101+
102+
environment:
103+
name: pypi
104+
url: https://pypi.org/p/xarray
105+
permissions:
106+
id-token: write
107+
87108
steps:
88109
- uses: actions/download-artifact@v3
89110
with:
@@ -92,6 +113,4 @@ jobs:
92113
- name: Publish package to PyPI
93114
uses: pypa/[email protected]
94115
with:
95-
user: __token__
96-
password: ${{ secrets.PYPI_TOKEN }}
97116
verbose: true

0 commit comments

Comments
 (0)