44 workflow_dispatch : # Manual trigger only (publish-release.yml handles automatic releases)
55
66jobs :
7- build :
8- name : Build distribution
7+ # Build source distribution (sdist) - only once, platform-independent
8+ build-sdist :
9+ name : Build Source Distribution
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - name : Set up Python
16+ uses : actions/setup-python@v5
17+ with :
18+ python-version : ' 3.11'
19+
20+ - name : Install build dependencies
21+ run : |
22+ python -m pip install --upgrade pip
23+ pip install build wheel setuptools
24+
25+ - name : Build source distribution only
26+ run : python -m build --sdist
27+
28+ - name : Upload sdist artifact
29+ uses : actions/upload-artifact@v4
30+ with :
31+ name : dist-sdist
32+ path : dist/*.tar.gz
33+
34+ # Build binary wheels for each platform/Python version
35+ build-wheels :
36+ name : Build Wheels
937 runs-on : ${{ matrix.os }}
1038 strategy :
1139 matrix :
@@ -25,23 +53,23 @@ jobs:
2553 python -m pip install --upgrade pip
2654 pip install build wheel setuptools
2755
28- - name : Build distribution
29- run : python -m build
56+ - name : Build wheel only
57+ run : python -m build --wheel
3058
31- - name : Upload artifacts
59+ - name : Upload wheel artifacts
3260 uses : actions/upload-artifact@v4
3361 with :
34- name : dist-${{ matrix.os }}-py${{ matrix.python-version }}
35- path : dist/
62+ name : dist-wheel- ${{ matrix.os }}-py${{ matrix.python-version }}
63+ path : dist/*.whl
3664
3765 publish-testpypi :
3866 name : Publish to TestPyPI
39- needs : build
67+ needs : [ build-sdist, build-wheels]
4068 runs-on : ubuntu-latest
4169 if : github.event_name == 'workflow_dispatch'
4270
4371 steps :
44- - name : Download artifacts
72+ - name : Download all artifacts
4573 uses : actions/download-artifact@v4
4674 with :
4775 pattern : dist-*
@@ -56,15 +84,15 @@ jobs:
5684
5785 publish-pypi :
5886 name : Publish to PyPI
59- needs : build
87+ needs : [ build-sdist, build-wheels]
6088 runs-on : ubuntu-latest
6189 if : github.event_name == 'release' && github.event.action == 'published'
6290
6391 permissions :
6492 id-token : write # For trusted publishing
6593
6694 steps :
67- - name : Download artifacts
95+ - name : Download all artifacts
6896 uses : actions/download-artifact@v4
6997 with :
7098 pattern : dist-*
0 commit comments