1- name : Build Wheels (Multi Arch)
1+ name : Build and Publish Wheels (Multi Arch)
22
33on :
44 push :
55 branches : [main, master]
66 pull_request :
77 branches : [main, master]
8+ release :
9+ types : [created] # This triggers the job when a new GitHub release is created.
810
911jobs :
10- default :
11- name : ${{ matrix.os }} - ${{ matrix.arch }}
12+ build :
13+ name : Build Wheels ( ${{ matrix.os }} - ${{ matrix.arch }})
1214 runs-on : ${{ matrix.os }}
1315 strategy :
1416 fail-fast : false
1517 matrix :
16- os : [ ubuntu-24.04, ubuntu-22.04, macos-15, windows-2025 ]
17- arch : [ x86_64 ]
18+ os : [ubuntu-24.04, ubuntu-22.04, macos-15, windows-2025]
19+ arch : [x86_64]
1820 include :
1921 - os : ubuntu-24.04-arm
2022 arch : aarch64
@@ -28,10 +30,31 @@ jobs:
2830 uses : actions/setup-python@v5
2931 with :
3032 python-version : 3.x
33+ - name : Install dependencies
34+ run : pip install --upgrade pip setuptools wheel twine
3135 - name : Build wheels
3236 run : pip wheel . -w dist
3337 - name : Upload wheels artifact
3438 uses : actions/upload-artifact@v4
3539 with :
3640 name : wheels-${{ matrix.os }}-${{ matrix.arch }}
41+ path : dist/*
42+
43+ publish :
44+ name : Publish to PyPI
45+ runs-on : ubuntu-latest
46+ needs : build # Ensure this job only runs if the build completes successfully.
47+ if : github.event_name == 'release' # Only publish when a release is created.
48+ steps :
49+ - uses : actions/checkout@v4
50+ - name : Download all built wheels
51+ uses : actions/download-artifact@v4
52+ with :
3753 path : dist
54+ - name : Publish package to PyPI
55+ env :
56+ PYPI_USERNAME : __token__
57+ PYPI_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
58+ run : |
59+ python -m pip install --upgrade twine
60+ python -m twine upload dist/** --username "$PYPI_USERNAME" --password "$PYPI_PASSWORD"
0 commit comments