Skip to content

Commit add1c6b

Browse files
authored
ci: use OIDC trusted publishing via wevm/changelogs (#138)
wevm/changelogs now natively supports PyPI Trusted Publishing (OIDC) as of tempoxyz/changelogs#116. When pypi-token is empty and the workflow has id-token: write, it mints a short-lived PyPI API token by exchanging the GitHub OIDC ID token at PyPI's _/oidc/mint-token endpoint, removing the need for a long-lived static API token. Pin to the merge commit (de02501) until a new changelogs release is cut, and grant id-token: write + environment: release to the release job so the OIDC mint flow runs and matches the registered Trusted Publisher (tempoxyz/pympp + publish.yml + release).
1 parent c871405 commit add1c6b

1 file changed

Lines changed: 2 additions & 31 deletions

File tree

.github/workflows/publish.yml

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,16 @@ jobs:
1616
permissions:
1717
contents: write
1818
pull-requests: write
19-
id-token: write
20-
outputs:
21-
published: ${{ steps.changelogs.outputs.published }}
19+
id-token: write # required for PyPI Trusted Publishing (OIDC)
2220
steps:
2321
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2422
with:
2523
persist-credentials: true
2624

27-
- id: changelogs
28-
uses: wevm/changelogs@056ab043d7affcd6871e8d972b5b5362e7349b57 # changelogs@0.6.3
25+
- uses: wevm/changelogs@de0250123a1d70a2b64a458bd5efcf313986df7a # OIDC trusted publishing
2926
with:
3027
ecosystem: python
3128
python-version: '3.12'
3229
conventional-commit: true
3330
env:
3431
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
36-
publish:
37-
name: Publish to PyPI
38-
needs: release
39-
if: needs.release.outputs.published == 'true'
40-
runs-on: ubuntu-latest
41-
environment: release
42-
permissions:
43-
id-token: write
44-
contents: read
45-
steps:
46-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
47-
with:
48-
persist-credentials: false
49-
50-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
51-
with:
52-
python-version: '3.12'
53-
54-
- name: Build package
55-
run: |
56-
pip install build
57-
python -m build
58-
59-
- name: Publish to PyPI
60-
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

0 commit comments

Comments
 (0)