Skip to content

Commit 45bf449

Browse files
committed
release: switch to OIDC trusted publishing (no token, nothing to rotate)
GitHub Actions mints a short-lived identity token the registry verifies against a trusted publisher configured once. Removes the API-token secret and its 90-day expiry entirely.
1 parent 29183d7 commit 45bf449

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@ on:
55
tags:
66
- "v*"
77

8+
# Publishing uses PyPI OIDC "trusted publishing": GitHub Actions mints a short-lived
9+
# identity token that PyPI verifies against a trusted publisher you configure once —
10+
# no API token, no secret, nothing that expires or needs rotating.
11+
#
12+
# One-time setup (owner: GetBusbar, repo: busbar-python, workflow: release.yml,
13+
# environment: leave blank) at:
14+
# https://pypi.org/manage/project/busbar-admin/settings/publishing/
815
jobs:
916
publish:
1017
runs-on: ubuntu-latest
18+
permissions:
19+
id-token: write # required for OIDC trusted publishing
20+
contents: read
1121
steps:
1222
- uses: actions/checkout@v4
1323

@@ -29,18 +39,5 @@ jobs:
2939
- name: Build sdist + wheel
3040
run: python -m build
3141

32-
# Publish is gated on the PyPI token secret. Without it, the build above
33-
# still runs and the job succeeds without publishing.
34-
- name: Publish to PyPI
35-
if: ${{ env.PYPI_API_TOKEN != '' }}
36-
env:
37-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
42+
- name: Publish to PyPI (OIDC trusted publishing — no token)
3843
uses: pypa/gh-action-pypi-publish@release/v1
39-
with:
40-
password: ${{ secrets.PYPI_API_TOKEN }}
41-
42-
- name: Note when token is absent
43-
if: ${{ env.PYPI_API_TOKEN == '' }}
44-
env:
45-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
46-
run: echo "::notice::PYPI_API_TOKEN not set — built artifacts but skipped publish."

0 commit comments

Comments
 (0)