Skip to content

Commit e39229e

Browse files
Rewrite release workflow with maturin-action multi-platform builds
Replace single-platform uv build with maturin-action matrix covering: - Linux x86_64 + aarch64 (manylinux, via Docker containers) - musllinux x86_64 + aarch64 (Alpine support) - macOS Intel (macos-15-intel) + Apple Silicon (macos-latest) - Windows x64 Security: all actions SHA-pinned, persist-credentials: false, permissions: {} at top level, no caching in release path. Build hardening: --locked (Cargo.lock), --compatibility pypi.
1 parent f7b893e commit e39229e

1 file changed

Lines changed: 126 additions & 19 deletions

File tree

.github/workflows/release.yml

Lines changed: 126 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,134 @@ on:
55
tags:
66
- "v*"
77
jobs:
8-
build:
9-
name: Build Distributions
8+
build-sdist:
9+
name: Build sdist
1010
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
13+
with:
14+
persist-credentials: false
15+
16+
- name: Build sdist
17+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
18+
with:
19+
command: sdist
20+
args: --out dist
21+
22+
- name: Upload sdist
23+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
24+
with:
25+
name: wheels-sdist
26+
path: dist/
27+
if-no-files-found: error
1128

29+
build-linux:
30+
name: Build wheel (linux-${{ matrix.target }})
31+
runs-on: ubuntu-22.04
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
target: [x86_64, aarch64]
1236
steps:
1337
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1438
with:
1539
persist-credentials: false
1640

17-
- name: Set up uv
18-
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
41+
- name: Build wheel
42+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
1943
with:
20-
version: "latest"
21-
enable-cache: false
44+
target: ${{ matrix.target }}
45+
manylinux: auto
46+
args: --release --locked --out dist --compatibility pypi
47+
48+
- name: Upload wheel
49+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
50+
with:
51+
name: wheels-linux-${{ matrix.target }}
52+
path: dist/
53+
if-no-files-found: error
54+
55+
build-musllinux:
56+
name: Build wheel (musllinux-${{ matrix.target }})
57+
runs-on: ubuntu-22.04
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
target: [x86_64, aarch64]
62+
steps:
63+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
64+
with:
65+
persist-credentials: false
66+
67+
- name: Build wheel
68+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
69+
with:
70+
target: ${{ matrix.target }}
71+
manylinux: musllinux_1_2
72+
args: --release --locked --out dist --compatibility pypi
73+
74+
- name: Upload wheel
75+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
76+
with:
77+
name: wheels-musllinux-${{ matrix.target }}
78+
path: dist/
79+
if-no-files-found: error
80+
81+
build-macos:
82+
name: Build wheel (macos-${{ matrix.platform.target }})
83+
runs-on: ${{ matrix.platform.runner }}
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
platform:
88+
- runner: macos-15-intel
89+
target: x86_64
90+
- runner: macos-latest
91+
target: aarch64
92+
steps:
93+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
94+
with:
95+
persist-credentials: false
96+
97+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
98+
with:
99+
python-version: "3.10"
22100

23-
- name: Build distributions
24-
run: uv build
101+
- name: Build wheel
102+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
103+
with:
104+
target: ${{ matrix.platform.target }}
105+
args: --release --locked --out dist --compatibility pypi
25106

26-
- name: Upload distributions
107+
- name: Upload wheel
27108
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
28109
with:
29-
name: dists
110+
name: wheels-macos-${{ matrix.platform.target }}
111+
path: dist/
112+
if-no-files-found: error
113+
114+
build-windows:
115+
name: Build wheel (windows-x64)
116+
runs-on: windows-latest
117+
steps:
118+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
119+
with:
120+
persist-credentials: false
121+
122+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
123+
with:
124+
python-version: "3.10"
125+
126+
- name: Build wheel
127+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
128+
with:
129+
target: x64
130+
args: --release --locked --out dist --compatibility pypi
131+
132+
- name: Upload wheel
133+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
134+
with:
135+
name: wheels-windows-x64
30136
path: dist/
31137
if-no-files-found: error
32138

@@ -35,24 +141,25 @@ jobs:
35141
runs-on: ubuntu-latest
36142
permissions:
37143
id-token: write # for Trusted Publishing
38-
needs: build
144+
needs:
145+
[build-sdist, build-linux, build-musllinux, build-macos, build-windows]
39146

40147
environment: release
41148

42149
steps:
150+
- name: Download all artifacts
151+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
152+
with:
153+
pattern: wheels-*
154+
path: dist/
155+
merge-multiple: true
156+
43157
- name: Set up uv
44158
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
45159
with:
46160
version: "latest"
47161
enable-cache: false
48162
ignore-empty-workdir: true
49163

50-
- name: Download distributions
51-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
52-
with:
53-
name: dists
54-
path: dist/
55-
56164
- name: Publish
57-
run: |
58-
uv publish --trusted-publishing always dist/*
165+
run: uv publish --trusted-publishing always dist/*

0 commit comments

Comments
 (0)