Skip to content

Commit 3d5e84e

Browse files
dkijaniaclaude
andcommitted
Add PyPI release workflow
Publishes to TestPyPI then PyPI on GitHub release creation. Uses trusted publishing (OIDC) — no API tokens needed in secrets. Tests run against all Python versions before publishing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 41e72e8 commit 3d5e84e

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Release to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.10", "3.11", "3.12", "3.13"]
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e ".[dev]"
25+
26+
- name: Run tests
27+
run: pytest -v
28+
29+
publish-testpypi:
30+
runs-on: ubuntu-latest
31+
needs: test
32+
environment: testpypi
33+
permissions:
34+
id-token: write
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.12"
42+
43+
- name: Build package
44+
run: |
45+
pip install build
46+
python -m build
47+
48+
- name: Publish to TestPyPI
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
with:
51+
repository-url: https://test.pypi.org/legacy/
52+
53+
publish-pypi:
54+
runs-on: ubuntu-latest
55+
needs: publish-testpypi
56+
environment: pypi
57+
permissions:
58+
id-token: write
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Set up Python
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: "3.12"
66+
67+
- name: Build package
68+
run: |
69+
pip install build
70+
python -m build
71+
72+
- name: Publish to PyPI
73+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)