Skip to content

Commit 80bb919

Browse files
authored
add GitHub Actions workflow for building and publishing to PyPI
1 parent 932ce69 commit 80bb919

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v1.[0-9]+.[0-9]+"
7+
workflow_dispatch: # ALLOW MANUAL TRIGGER
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.16.5
22+
env:
23+
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-* cp314-*
24+
CIBW_SKIP: "*-musllinux_*"
25+
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: wheels-${{ matrix.os }}
29+
path: ./wheelhouse/*.whl
30+
31+
build_sdist:
32+
name: Build source distribution
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Build sdist
38+
run: pipx run build --sdist
39+
40+
- uses: actions/upload-artifact@v4
41+
with:
42+
name: sdist
43+
path: dist/*.tar.gz
44+
45+
upload_pypi:
46+
needs: [build_wheels, build_sdist]
47+
runs-on: ubuntu-latest
48+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
49+
steps:
50+
- uses: actions/download-artifact@v4
51+
with:
52+
pattern: "*"
53+
merge-multiple: true
54+
path: dist
55+
56+
- uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)