Skip to content

Commit 914b481

Browse files
keonclaude
andcommitted
Add trusted publishing workflow for PyPI
Publishes to PyPI via OIDC trusted publishing whenever a GitHub release is created. No API tokens needed — uses pypa/gh-action-pypi-publish with the 'pypi' environment for approval gating. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f7dc59d commit 914b481

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: "3.13"
17+
18+
- name: Install build tools
19+
run: python -m pip install --upgrade pip build
20+
21+
- name: Build package
22+
run: python -m build
23+
24+
- name: Upload build artifacts
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: dist
28+
path: dist/
29+
30+
publish:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment: pypi
34+
permissions:
35+
id-token: write
36+
steps:
37+
- name: Download build artifacts
38+
uses: actions/download-artifact@v4
39+
with:
40+
name: dist
41+
path: dist/
42+
43+
- name: Publish to PyPI
44+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)