Skip to content

Commit 24e3a35

Browse files
committed
ci: add token-based PyPI publish workflow
1 parent 6f94565 commit 24e3a35

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

.github/workflows/publish.yml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
11
name: Publish to PyPI
22

3-
# Manual trigger only — packages published via uv publish
43
on:
54
workflow_dispatch:
65

7-
permissions:
8-
id-token: write
9-
106
jobs:
11-
publish:
7+
test-build-publish:
128
runs-on: ubuntu-latest
13-
environment: pypi
9+
timeout-minutes: 20
1410
steps:
1511
- uses: actions/checkout@v4
12+
1613
- uses: actions/setup-python@v5
1714
with:
1815
python-version: "3.12"
19-
- name: Install build tools
20-
run: pip install build
21-
- name: Build package
22-
run: python -m build
16+
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install -e ".[dev]" || pip install -e ".[test]" || pip install -e .
21+
22+
- name: Run tests
23+
run: |
24+
if [ -d tests ]; then
25+
python -m pytest tests/ -q --tb=short --timeout=120
26+
else
27+
echo "No tests directory — skipping"
28+
fi
29+
30+
- name: Build
31+
run: |
32+
pip install build
33+
python -m build
34+
2335
- name: Publish to PyPI
24-
uses: pypa/gh-action-pypi-publish@release/v1
36+
env:
37+
TWINE_USERNAME: __token__
38+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
39+
run: |
40+
pip install twine
41+
twine upload --skip-existing dist/*

0 commit comments

Comments
 (0)