77
88
99jobs :
10- release :
11- name : Build and Release
10+ build :
11+ name : Build for Python ${{ matrix.python-version }}
1212 runs-on : ubuntu-latest
1313 if : startsWith(github.ref, 'refs/tags/v')
14- permissions :
15- contents : write
14+ strategy :
15+ matrix :
16+ python-version : ["3.12", "3.13"]
1617 steps :
1718 - uses : actions/checkout@v4
1819
19- - name : Set up Python
20+ - name : Set up Python ${{ matrix.python-version }}
2021 uses : actions/setup-python@v5
2122 with :
22- python-version : " 3.13 "
23+ python-version : ${{ matrix.python-version }}
2324
2425 - name : Install Poetry
2526 uses : snok/install-poetry@v1
@@ -30,25 +31,65 @@ jobs:
3031 - name : Install build dependencies only
3132 run : poetry install --only main --no-interaction --no-ansi
3233
33- - name : Build package
34- run : poetry build
34+ - name : Build package with custom build script
35+ run : |
36+ poetry run python build.py
37+ poetry build
38+
39+ - name : Rename artifacts with Python version
40+ run : |
41+ mkdir -p dist-py${{ matrix.python-version }}
42+ cp dist/*.whl dist-py${{ matrix.python-version }}/
43+ cp dist/*.tar.gz dist-py${{ matrix.python-version }}/
44+ # Rename wheel to include Python version
45+ cd dist-py${{ matrix.python-version }}
46+ for file in *.whl; do
47+ if [[ "$file" != *"py${{ matrix.python-version }}"* ]]; then
48+ mv "$file" "${file%.whl}-py${{ matrix.python-version }}.whl"
49+ fi
50+ done
51+
52+ - name : Upload Python ${{ matrix.python-version }} artifacts
53+ uses : actions/upload-artifact@v4
54+ with :
55+ name : python-packages-${{ matrix.python-version }}
56+ path : dist-py${{ matrix.python-version }}/
57+ retention-days : 7
58+
59+ release :
60+ name : Create Release
61+ runs-on : ubuntu-latest
62+ needs : build
63+ if : startsWith(github.ref, 'refs/tags/v')
64+ permissions :
65+ contents : write
66+ steps :
67+ - name : Download all artifacts
68+ uses : actions/download-artifact@v4
69+ with :
70+ path : artifacts/
71+
72+ - name : Prepare release assets
73+ run : |
74+ mkdir -p release-assets
75+ find artifacts/ -name "*.whl" -exec cp {} release-assets/ \;
76+ find artifacts/ -name "*.tar.gz" -exec cp {} release-assets/ \;
3577
3678 - name : Create Release
3779 uses : softprops/action-gh-release@v2
3880 with :
3981 name : Release ${{ github.ref_name }}
40- body : Automated release for version ${{ github.ref_name }}
82+ body : |
83+ Automated release for version ${{ github.ref_name }}
4184 draft : false
4285 prerelease : false
43- files : |
44- dist/*.whl
45- dist/*.tar.gz
86+ files : release-assets/*
4687
47- - name : Upload artifacts for PyPI
88+ - name : Upload combined artifacts for PyPI
4889 uses : actions/upload-artifact@v4
4990 with :
50- name : python-packages
51- path : dist /
91+ name : python-packages-combined
92+ path : release-assets /
5293 retention-days : 7
5394
5495 publish :
63104 - name : Download package artifacts
64105 uses : actions/download-artifact@v4
65106 with :
66- name : python-packages
107+ name : python-packages-combined
67108 path : dist
68109
69110 - name : Publish to TestPyPI
0 commit comments