Skip to content

Commit db148da

Browse files
committed
✨ Add release workflow for building and publishing wheels to PyPI
1 parent 867320b commit db148da

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: Install uv
2828
uses: astral-sh/setup-uv@v5
2929

30+
- name: Install maturin
31+
run: uv pip install maturin
32+
3033
- name: Install dependencies
3134
run: uv sync --dev
3235

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
build:
14+
name: Build wheels (${{ matrix.os }})
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
20+
steps:
21+
- uses: actions/checkout@v6
22+
23+
- name: Install Rust
24+
uses: dtolnay/rust-toolchain@stable
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v6
28+
with:
29+
python-version: "3.12"
30+
31+
- name: Build wheels (Linux)
32+
if: matrix.os == 'ubuntu-latest'
33+
uses: PyO3/maturin-action@v1
34+
with:
35+
command: build
36+
args: --release --out dist
37+
manylinux: auto
38+
39+
- name: Build wheels (macOS / Windows)
40+
if: matrix.os != 'ubuntu-latest'
41+
uses: PyO3/maturin-action@v1
42+
with:
43+
command: build
44+
args: --release --out dist
45+
46+
- name: Upload wheels
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: wheels-${{ matrix.os }}
50+
path: dist
51+
52+
publish:
53+
name: Publish to PyPI
54+
needs: build
55+
runs-on: ubuntu-latest
56+
environment: pypi
57+
58+
steps:
59+
- name: Download wheels
60+
uses: actions/download-artifact@v4
61+
with:
62+
pattern: wheels-*
63+
merge-multiple: true
64+
path: dist
65+
66+
- name: Publish to PyPI
67+
uses: pypa/gh-action-pypi-publish@release/v1
68+
with:
69+
packages-dir: dist

0 commit comments

Comments
 (0)