Skip to content

Commit 64feffc

Browse files
authored
ci: publish to PyPI via trusted publishing instead of an API token (#96)
* ci: publish publish.yml via trusted publishing instead of an API token * ci: publish pre-release.yml via trusted publishing instead of an API token
1 parent f356b45 commit 64feffc

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/pre-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
pypi-publish:
2222
name: Build dist & upload to PyPI
2323
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write # mint the OIDC token PyPI trusted publishing verifies
26+
contents: read # actions/checkout
2427
if: ${{ github.actor == 'github-actions[bot]' || github.actor == 'ryanhill1' }}
2528
steps:
2629
- uses: actions/checkout@v4
@@ -54,6 +57,4 @@ jobs:
5457
- name: Publish package to PyPI
5558
uses: pypa/gh-action-pypi-publish@release/v1
5659
with:
57-
user: __token__
58-
password: ${{ secrets.PYPI_API_TOKEN }}
5960
packages-dir: ${{ steps.build-dev.outputs.dir }}

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
pypi-publish:
2222
name: Build dist & upload to PyPI
2323
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write # mint the OIDC token PyPI trusted publishing verifies
26+
contents: read # actions/checkout
2427
if: ${{ github.actor == 'github-actions[bot]' || github.actor == 'ryanhill1' }}
2528
environment: release
2629
steps:
@@ -40,6 +43,3 @@ jobs:
4043
4144
- name: Publish package to PyPI
4245
uses: pypa/gh-action-pypi-publish@release/v1
43-
with:
44-
user: __token__
45-
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)