@@ -51,10 +51,13 @@ jobs:
5151 pip install pytest
5252 pytest
5353
54- build-for-publish :
54+ build-wheels- for-publish :
5555 name : Build distribution 📦
56- runs-on : ubuntu-latest
5756 if : " startsWith(github.ref, 'refs/tags')"
57+ runs-on : ${{ matrix.os }}
58+ strategy :
59+ matrix :
60+ os : [ubuntu-latest, ubuntu-latest-arm, windows-latest, macos-latest]
5861 needs : test
5962 steps :
6063 - uses : actions/checkout@v4
@@ -68,24 +71,55 @@ jobs:
6871
6972 - name : Install dependencies
7073 run : |
71- python -m pip install --upgrade build
74+ python -m pip install cibuildwheel==2.16.2
7275
73- - name : Build a source tarball and wheel
74- run : python -m build .
76+ - name : Build wheels
77+ env :
78+ CIBW_SKIP : " pp* *-musllinux_*"
79+ run : python -m cibuildwheel --output-dir wheelhouse
7580
7681 - name : Store the distribution packages
7782 uses : actions/upload-artifact@v4
7883 with :
79- name : python-package-distributions
80- # NOTE: for now upload sdist only to prevent errors like unsupported platform tag 'linux_x86_64'.
84+ name : cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
85+ path : ./wheelhouse/*.whl
86+
87+ build-sdist-for-publish :
88+ name : Build source distribution 📦
89+ if : " startsWith(github.ref, 'refs/tags')"
90+ runs-on : ubuntu-latest
91+ needs : test
92+ steps :
93+ - name : Checkout repository
94+ uses : actions/checkout@v4
95+ with :
96+ fetch-depth : 0
97+ submodules : true
98+ - name : Set up Python
99+ uses : actions/setup-python@v5
100+ with :
101+ python-version : ' 3.11'
102+ - name : Install dependencies
103+ run : |
104+ python -m pip install --upgrade pip
105+ pip install -e ".[dev]"
106+ - name : Install build tool
107+ run : python -m pip install sdist
108+ - name : Build source distribution
109+ run : python setup.py sdist
110+ - name : Upload sdist artifact
111+ uses : actions/upload-artifact@v4
112+ with :
113+ name : sdist-artifact
81114 path : dist/*.tar.gz
82115
83116 publish-to-pypi :
84117 name : >-
85118 Publish Python 🐍 distribution 📦 to PyPI
86119 if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
87120 needs :
88- - build-for-publish
121+ - build-wheels-for-publish
122+ - build-sdist-for-publish
89123 runs-on : ubuntu-latest
90124 environment :
91125 name : pypi
@@ -96,12 +130,20 @@ jobs:
96130 - name : Download all the dists
97131 uses : actions/download-artifact@v4
98132 with :
99- name : python-package-distributions
100- path : dist/
133+ # unpacks all CIBW artifacts into dist/
134+ path : dist
135+ pattern : cibw-wheels-*
136+ merge-multiple : true
137+ - name : Download sdist artifact
138+ uses : actions/download-artifact@v4
139+ with :
140+ name : sdist-artifact
141+ path : dist
101142 - name : Publish distribution 📦 to PyPI
102143 uses : pypa/gh-action-pypi-publish@release/v1
103144 with :
104145 verbose : true
146+ password : ${{ secrets.PYPI_TOKEN }}
105147
106148 # NOTE: for testing purposes only
107149 # publish-to-testpypi:
0 commit comments