Skip to content

Commit 794acae

Browse files
L7-FLYWHEEL: Add PyPI publish workflow with trusted publishing
Triggers on tag push (v*) and manual dispatch. Pipeline: test → build → publish via OIDC trusted publishing.
1 parent 9716dc7 commit 794acae

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/publish.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
env:
10+
PYTHON_VERSION: '3.11'
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ env.PYTHON_VERSION }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e ".[dev]" 2>/dev/null || pip install -e "." && pip install pytest
28+
29+
- name: Run pytest
30+
run: pytest --tb=short -q
31+
32+
build:
33+
name: Build
34+
runs-on: ubuntu-latest
35+
needs: test
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Set up Python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: ${{ env.PYTHON_VERSION }}
43+
44+
- name: Install build dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install build
48+
49+
- name: Build distribution
50+
run: python -m build
51+
52+
- name: Upload artifacts
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: dist
56+
path: dist/
57+
58+
publish:
59+
name: Publish to PyPI
60+
runs-on: ubuntu-latest
61+
needs: build
62+
environment: pypi
63+
permissions:
64+
id-token: write
65+
steps:
66+
- uses: actions/download-artifact@v4
67+
with:
68+
name: dist
69+
path: dist/
70+
71+
- name: Publish to PyPI
72+
uses: pypa/gh-action-pypi-publish@release/v1
73+
with:
74+
packages-dir: dist/

0 commit comments

Comments
 (0)