Skip to content

Commit 81c4f29

Browse files
committed
Use Trusted publishing for PyPI
1 parent 23f92ec commit 81c4f29

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.github/workflows/build-dist.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ jobs:
9191
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
9292
# alternatively, to publish when a GitHub Release is created, use the following rule:
9393
# if: github.event_name == 'release' && github.event.action == 'published'
94+
95+
environment:
96+
name: pypi
97+
url: https://pypi.org/p/soxr
98+
permissions:
99+
contents: write
100+
id-token: write # IMPORTANT: mandatory for trusted publishing
101+
94102
steps:
95103
- uses: actions/download-artifact@v4
96104
with:
@@ -99,16 +107,11 @@ jobs:
99107
merge-multiple: true
100108

101109
- uses: softprops/action-gh-release@v2
102-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
103110
with:
104111
files: |
105112
dist/*.tar.gz
106113
dist/*.whl
107114
108115
- uses: pypa/gh-action-pypi-publish@release/v1
109-
with:
110-
user: __token__
111-
password: ${{ secrets.PYPI_API_TOKEN }}
112-
# To test
113-
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
114-
# repository_url: https://test.pypi.org/legacy/
116+
# with:
117+
# repository_url: https://test.pypi.org/legacy/ # To test

0 commit comments

Comments
 (0)