Skip to content

Commit

Permalink
Add trusted publishing to PyPI
Browse files Browse the repository at this point in the history
PyPI recently introduced trusted publishing from sources such as
GitHub Actions. This change takes advantage of that for publishing
to PyPI and Test PyPI.

https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/

Signed-off-by: Eric Brown <[email protected]>
  • Loading branch information
ericwb committed Jan 29, 2024
1 parent ede67b8 commit d2f7dd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -25,5 +28,3 @@ jobs:
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_PASSWORD }}
4 changes: 3 additions & 1 deletion .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ jobs:
build-n-publish:
name: Build and publish to Test PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -25,5 +28,4 @@ jobs:
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/

0 comments on commit d2f7dd1

Please sign in to comment.