Skip to content

Commit 11ff2df

Browse files
Merge pull request #2101 from VWS-Python/trusted-pypi
Use PyPI trusted publisher rather than API token
2 parents 555f83f + 7a87858 commit 11ff2df

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ jobs:
99
name: Publish a release
1010
runs-on: ubuntu-latest
1111

12+
# Specifying an environment is strongly recommended by PyPI.
13+
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
14+
environment: release
15+
16+
permissions:
17+
# This is needed for PyPI publishing.
18+
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
19+
id-token: write
20+
# This is needed for https://github.com/stefanzweifel/git-auto-commit-action.
21+
contents: write
22+
1223
strategy:
1324
matrix:
1425
python-version: ["3.12"]
@@ -69,8 +80,9 @@ jobs:
6980
python -m pip install build
7081
python -m build --sdist --wheel --outdir dist/ .
7182
83+
# We use PyPI trusted publishing rather than a PyPI API token.
84+
# See https://github.com/pypa/gh-action-pypi-publish/tree/release/v1/?tab=readme-ov-file#trusted-publishing.
7285
- name: Publish distribution 📦 to PyPI
7386
uses: pypa/gh-action-pypi-publish@release/v1
7487
with:
75-
password: ${{ secrets.PYPI_API_TOKEN }}
7688
verbose: true

0 commit comments

Comments
 (0)