Skip to content

Commit 6b71fa6

Browse files
authored
chore(release): fix maturin build and pypi deploy (#99)
1 parent 9f2f0b8 commit 6b71fa6

File tree

1 file changed

+86
-18
lines changed

1 file changed

+86
-18
lines changed

.github/workflows/release-please.yml

Lines changed: 86 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,113 @@ jobs:
2323
release-type: python
2424
target-branch: main
2525

26-
build:
27-
name: upload wheel & publish to pypi
28-
runs-on: ubuntu-latest
26+
build-wheels:
27+
name: build wheels (${{ matrix.label }})
28+
runs-on: ${{ matrix.os }}
2929
needs: release-please
3030
if: ${{ needs.release-please.outputs.releases_created == 'true' && needs.release-please.outputs.tag_name != '' }}
31-
32-
environment: pypi
33-
permissions:
34-
id-token: write
35-
contents: write
36-
3731
strategy:
3832
fail-fast: false
3933
matrix:
34+
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
4035
python-version: ["3.14"]
36+
include:
37+
- os: ubuntu-latest
38+
label: linux-x86_64
39+
extra-args: "--compatibility manylinux_2_35"
40+
- os: macos-13
41+
label: macos-x86_64
42+
extra-args: ""
43+
- os: macos-14
44+
label: macos-aarch64
45+
extra-args: ""
46+
- os: windows-latest
47+
label: windows-x86_64
48+
extra-args: ""
4149
steps:
4250
- uses: actions/checkout@v4
4351

44-
- name: Install uv & set Python
52+
- name: Install uv
4553
uses: astral-sh/setup-uv@v7
4654
with:
4755
python-version: ${{ matrix.python-version }}
48-
enable-cache: true
49-
cache-python: true
5056

51-
- name: Install Python ${{ matrix.python-version }}
52-
run: uv python install ${{ matrix.python-version }}
57+
- name: Install maturin
58+
run: uv tool install maturin
5359

54-
- name: Sync dependencies
55-
run: uv sync --frozen
60+
- name: Setup Rust
61+
uses: dtolnay/rust-toolchain@stable
5662

5763
- name: Build wheel
58-
run: uv build
64+
run: uvx maturin build --release --out dist ${{ matrix.extra-args }}
65+
66+
- name: Upload wheel artifact
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: wheels-${{ matrix.label }}
70+
path: dist/*.whl
71+
if-no-files-found: error
72+
73+
build-sdist:
74+
name: build sdist
75+
runs-on: ubuntu-latest
76+
needs: release-please
77+
if: ${{ needs.release-please.outputs.releases_created == 'true' && needs.release-please.outputs.tag_name != '' }}
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- name: Install uv
82+
uses: astral-sh/setup-uv@v7
83+
with:
84+
python-version: "3.14"
85+
86+
- name: Setup Rust
87+
uses: dtolnay/rust-toolchain@stable
88+
89+
- name: Install maturin
90+
run: uv tool install maturin
91+
92+
- name: Build sdist
93+
run: uvx maturin sdist --out dist
94+
95+
- name: Upload sdist artifact
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: sdist
99+
path: dist/*.tar.gz
100+
if-no-files-found: error
101+
102+
publish:
103+
name: publish release artifacts
104+
runs-on: ubuntu-latest
105+
needs:
106+
- release-please
107+
- build-wheels
108+
- build-sdist
109+
if: ${{ needs.release-please.outputs.releases_created == 'true' && needs.release-please.outputs.tag_name != '' }}
110+
environment: pypi
111+
permissions:
112+
id-token: write
113+
contents: write
114+
steps:
115+
- name: Download wheel artifacts
116+
uses: actions/download-artifact@v4
117+
with:
118+
pattern: wheels-*
119+
merge-multiple: true
120+
path: dist
121+
122+
- name: Download sdist artifact
123+
uses: actions/download-artifact@v4
124+
with:
125+
name: sdist
126+
path: dist
59127

60128
- name: Upload binaries to release
61129
uses: svenstaro/upload-release-action@v2
62130
with:
63131
repo_token: ${{ secrets.GITHUB_TOKEN }}
64-
file: dist/memu_*.whl
132+
file: dist/*
65133
tag: ${{ needs.release-please.outputs.tag_name }}
66134
file_glob: true
67135

0 commit comments

Comments
 (0)