Skip to content

Commit fbdd969

Browse files
authored
Update CI workflow to build and publish wheels
1 parent a2019be commit fbdd969

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

.github/workflows/build-wheels.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and publish wheels
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*"]
7+
8+
9+
jobs:
10+
build_wheels:
11+
name: Build wheels on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Build wheels
21+
uses: pypa/cibuildwheel@v2.23.3
22+
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: wheels-${{ matrix.os }}
26+
path: ./wheelhouse/*.whl
27+
28+
build_sdist:
29+
name: Build source distribution
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Build sdist
35+
run: pipx run build --sdist
36+
37+
- uses: actions/upload-artifact@v4
38+
with:
39+
name: sdist
40+
path: dist/*.tar.gz
41+
42+
upload_pypi:
43+
needs: [build_wheels, build_sdist]
44+
runs-on: ubuntu-latest
45+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
46+
47+
steps:
48+
- uses: actions/download-artifact@v4
49+
with:
50+
pattern: wheels-*
51+
path: dist/
52+
merge-multiple: true
53+
54+
- uses: actions/download-artifact@v4
55+
with:
56+
name: sdist
57+
path: dist/
58+
59+
- uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)