Skip to content

Commit 4b22431

Browse files
lesnik512claude
andauthored
ci: publish to PyPI via Trusted Publishing (OIDC) (#123)
* ci: publish to PyPI via Trusted Publishing (OIDC) Drop the long-lived PYPI_TOKEN secret in favor of OIDC. uv publish auto-detects the GitHub Actions id-token, so the release job grants id-token: write and runs under a `pypi` environment that scopes the PyPI Trusted Publisher. Requires a matching Trusted Publisher on the faststream-outbox PyPI project (workflow: release.yml, environment: pypi) before the next tag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(release): add 0.10.5 notes (Trusted Publishing pipeline) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1f6033e commit 4b22431

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ on:
1111
- '[0-9]+.[0-9]+.[0-9]+' # stable: 2.7.2
1212
- '[0-9]+.[0-9]+.[0-9]+[a-z]+[0-9]+' # pre-release: 2.0.0rc1, 4.0.0a2
1313

14-
# Needed for softprops/action-gh-release to create the GitHub Release.
14+
# contents: write -> create the GitHub Release; id-token: write -> OIDC for PyPI Trusted Publishing.
1515
permissions:
1616
contents: write
17+
id-token: write
1718

1819
jobs:
1920
release:
2021
runs-on: ubuntu-latest
22+
environment: pypi # scopes the PyPI Trusted Publisher; hook for approval rules
2123
steps:
2224
- uses: actions/checkout@v6
2325
- uses: extractions/setup-just@v4
@@ -45,9 +47,9 @@ jobs:
4547
# PyPI is irreversible, so it runs FIRST: if it fails the job stops and no
4648
# GitHub Release is created advertising a version that never reached PyPI.
4749
# `just publish` derives the version from $GITHUB_REF_NAME (the tag name).
50+
# Auth via PyPI Trusted Publishing (OIDC); no PYPI_TOKEN. Needs a Trusted
51+
# Publisher on the faststream-outbox PyPI project (env: pypi, workflow: release.yml).
4852
- run: just publish
49-
env:
50-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
5153

5254
# Description source: planning/releases/<tag>.md if present (verbatim, no
5355
# auto-changelog appended); otherwise GitHub's generated notes. A tag with

‎Justfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ index:
3737
check-planning:
3838
uv run python planning/index.py --check
3939

40+
# Auth via PyPI Trusted Publishing (OIDC); uv publish auto-detects the CI id-token.
4041
publish:
4142
rm -rf dist
4243
uv version $GITHUB_REF_NAME
4344
uv build
44-
uv publish --token $PYPI_TOKEN
45+
uv publish
4546

4647
# Serve docs at http://127.0.0.1:8000 with hot-reload on save.
4748
docs-serve:

‎planning/releases/0.10.5.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# faststream-outbox 0.10.5 — release pipeline on PyPI Trusted Publishing
2+
3+
No library changes. The package is identical to 0.10.4; this release exercises the new publish path end-to-end.
4+
5+
## CI
6+
7+
- Releases now authenticate to PyPI via **Trusted Publishing (OIDC)** instead of a long-lived `PYPI_TOKEN` secret. `uv publish` auto-detects the GitHub Actions id-token; the release job runs under a `pypi` environment that scopes the trusted publisher (#123).
8+
9+
## Downstream
10+
11+
No action required. Nothing about the installed package changes.

0 commit comments

Comments
 (0)