Skip to content

Commit 65979b7

Browse files
committed
Adapt the GHA PyPI publishing workflow for trusted publishing
All the changes here are in line with those recently made to the PyMC workflow
1 parent bb23d9b commit 65979b7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/pypi.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ jobs:
5050
name: upload release to PyPI
5151
needs: [build]
5252
runs-on: ubuntu-latest
53-
if: github.event_name == 'release' && github.event.action == 'published'
53+
if: github.repository_owner == 'pymc-devs' && github.event_name == 'release' && github.event.action == 'published'
54+
# Use the `release` GitHub environment to protect the Trusted Publishing (OIDC)
55+
# workflow by requiring signoff from a maintainer.
56+
environment: release
57+
permissions:
58+
# write id-token is necessary for trusted publishing (OIDC)
59+
id-token: write
5460
steps:
5561
- uses: actions/download-artifact@v3
5662
with:
5763
name: artifact
5864
path: dist
5965
- uses: pypa/gh-action-pypi-publish@release/v1
60-
with:
61-
user: __token__
62-
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)