Skip to content

Commit 14057fc

Browse files
committed
Publish to TestPyPI and PyPI via OpenID Connect token
Using a short-lived API token generated by OpenID Connect (OIDC) instead of a long-lived secret to publish packages to TestPyPI and PyPI. Refer to https://github.com/pypa/gh-action-pypi-publish/tree/v1.8.1#ipublishing-with-openid-connect
1 parent cee93a4 commit 14057fc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/workflows/publish-to-pypi.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
publish-pypi:
2020
name: Publish to PyPI
2121
runs-on: ubuntu-latest
22+
permissions:
23+
# This permission is mandatory for OIDC publishing
24+
id-token: write
2225
if: github.repository == 'GenericMappingTools/pygmt'
2326

2427
steps:
@@ -53,13 +56,10 @@ jobs:
5356
ls -lh dist/
5457
5558
- name: Publish to Test PyPI
56-
uses: pypa/[email protected].1
59+
uses: pypa/[email protected].3
5760
with:
58-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
5961
repository-url: https://test.pypi.org/legacy/
6062

6163
- name: Publish to PyPI
6264
if: startsWith(github.ref, 'refs/tags')
63-
uses: pypa/[email protected]
64-
with:
65-
password: ${{ secrets.PYPI_API_TOKEN }}
65+
uses: pypa/[email protected]

0 commit comments

Comments
 (0)