Skip to content

Commit 6531ebf

Browse files
Transurgeonclaude
andcommitted
Add CI/CD workflow for building wheels and publishing to PyPI
Uses cibuildwheel to build platform wheels on Linux, macOS, and Windows. Publishes to PyPI via trusted publishing on v* tag pushes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a5e1246 commit 6531ebf

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)