Skip to content

Commit ac1a766

Browse files
authored
Add workflow to publish releases to pypi (#14)
1 parent ed07792 commit ac1a766

File tree

4 files changed

+1154
-2
lines changed

4 files changed

+1154
-2
lines changed

.github/workflows/release.yml

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- released
7+
pull_request:
8+
branches: [main]
9+
types:
10+
- opened
11+
- reopened
12+
- synchronize
13+
- ready_for_review
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
linux:
21+
runs-on: ${{ matrix.platform.runner }}
22+
strategy:
23+
matrix:
24+
platform:
25+
- runner: ubuntu-22.04
26+
target: x86_64
27+
- runner: ubuntu-22.04
28+
target: x86
29+
- runner: ubuntu-22.04
30+
target: aarch64
31+
- runner: ubuntu-22.04
32+
target: armv7
33+
- runner: ubuntu-22.04
34+
target: s390x
35+
- runner: ubuntu-22.04
36+
target: ppc64le
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: '>=3.9'
42+
- name: Build wheels
43+
uses: PyO3/maturin-action@v1
44+
with:
45+
target: ${{ matrix.platform.target }}
46+
args: --release --out dist --find-interpreter
47+
sccache: 'true'
48+
manylinux: auto
49+
- name: Upload wheels
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: wheels-linux-${{ matrix.platform.target }}
53+
path: dist
54+
55+
musllinux:
56+
runs-on: ${{ matrix.platform.runner }}
57+
strategy:
58+
matrix:
59+
platform:
60+
- runner: ubuntu-22.04
61+
target: x86_64
62+
- runner: ubuntu-22.04
63+
target: x86
64+
- runner: ubuntu-22.04
65+
target: aarch64
66+
- runner: ubuntu-22.04
67+
target: armv7
68+
steps:
69+
- uses: actions/checkout@v4
70+
- uses: actions/setup-python@v5
71+
with:
72+
python-version: '>=3.9'
73+
- name: Build wheels
74+
uses: PyO3/maturin-action@v1
75+
with:
76+
target: ${{ matrix.platform.target }}
77+
args: --release --out dist --find-interpreter
78+
sccache: 'true'
79+
manylinux: musllinux_1_2
80+
- name: Upload wheels
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: wheels-musllinux-${{ matrix.platform.target }}
84+
path: dist
85+
86+
windows:
87+
runs-on: ${{ matrix.platform.runner }}
88+
strategy:
89+
matrix:
90+
platform:
91+
- runner: windows-latest
92+
target: x64
93+
- runner: windows-latest
94+
target: x86
95+
steps:
96+
- uses: actions/checkout@v4
97+
- uses: actions/setup-python@v5
98+
with:
99+
python-version: '>=3.9'
100+
architecture: ${{ matrix.platform.target }}
101+
- name: Build wheels
102+
uses: PyO3/maturin-action@v1
103+
with:
104+
target: ${{ matrix.platform.target }}
105+
args: --release --out dist --find-interpreter
106+
sccache: 'true'
107+
- name: Upload wheels
108+
uses: actions/upload-artifact@v4
109+
with:
110+
name: wheels-windows-${{ matrix.platform.target }}
111+
path: dist
112+
113+
macos:
114+
runs-on: ${{ matrix.platform.runner }}
115+
strategy:
116+
matrix:
117+
platform:
118+
- runner: macos-13
119+
target: x86_64
120+
- runner: macos-14
121+
target: aarch64
122+
steps:
123+
- uses: actions/checkout@v4
124+
- uses: actions/setup-python@v5
125+
with:
126+
python-version: '>=3.9'
127+
- name: Build wheels
128+
uses: PyO3/maturin-action@v1
129+
with:
130+
target: ${{ matrix.platform.target }}
131+
args: --release --out dist --find-interpreter
132+
sccache: 'true'
133+
- name: Upload wheels
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: wheels-macos-${{ matrix.platform.target }}
137+
path: dist
138+
139+
emscripten:
140+
runs-on: ${{ matrix.platform.runner }}
141+
strategy:
142+
matrix:
143+
platform:
144+
- runner: ubuntu-22.04
145+
target: wasm32-unknown-emscripten
146+
steps:
147+
- uses: actions/checkout@v4
148+
- run: pip install pyodide-build
149+
- name: Get Emscripten and Python version info
150+
shell: bash
151+
run: |
152+
echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
153+
echo PYTHON_VERSION=$(pyodide config get python_version | cut -d '.' -f 1-2) >> $GITHUB_ENV
154+
pip uninstall -y pyodide-build
155+
- uses: mymindstorm/setup-emsdk@v12
156+
with:
157+
version: ${{ env.EMSCRIPTEN_VERSION }}
158+
actions-cache-folder: emsdk-cache
159+
- uses: actions/setup-python@v5
160+
with:
161+
python-version: ${{ env.PYTHON_VERSION }}
162+
- run: pip install pyodide-build
163+
- name: Build wheels
164+
uses: PyO3/maturin-action@v1
165+
with:
166+
target: ${{ matrix.platform.target }}
167+
args: --release --out dist -i ${{ env.PYTHON_VERSION }}
168+
sccache: 'true'
169+
rust-toolchain: nightly
170+
- name: Upload wheels
171+
uses: actions/upload-artifact@v4
172+
with:
173+
name: wasm-wheels
174+
path: dist
175+
176+
sdist:
177+
runs-on: ubuntu-latest
178+
steps:
179+
- uses: actions/checkout@v4
180+
- name: Build sdist
181+
uses: PyO3/maturin-action@v1
182+
with:
183+
command: sdist
184+
args: --out dist
185+
- name: Upload sdist
186+
uses: actions/upload-artifact@v4
187+
with:
188+
name: wheels-sdist
189+
path: dist
190+
191+
release:
192+
name: Release
193+
runs-on: ubuntu-latest
194+
if: ${{ github.event_name == 'release' }}
195+
needs: [linux, musllinux, windows, macos, emscripten, sdist]
196+
environment:
197+
name: pypi
198+
url: https://pypi.org/p/vodozemac
199+
permissions:
200+
# Use to sign the release artifacts
201+
id-token: write
202+
# Used to upload release artifacts
203+
contents: write
204+
# Used to generate artifact attestation
205+
attestations: write
206+
steps:
207+
- uses: actions/download-artifact@v4
208+
- name: Generate artifact attestation
209+
uses: actions/attest-build-provenance@v1
210+
with:
211+
subject-path: 'wheels-*/*'
212+
- name: Publish to PyPI
213+
if: "startsWith(github.ref, 'refs/tags/')"
214+
uses: PyO3/maturin-action@v1
215+
with:
216+
command: upload
217+
args: --non-interactive --skip-existing wheels-*/*
218+
- name: Upload to GitHub Release
219+
uses: softprops/action-gh-release@v1
220+
with:
221+
files: |
222+
wasm-wheels/*.whl
223+
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ cython_debug/
159159
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160160
# and can be added to the global gitignore or merged into this file. For a more nuclear
161161
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
#.idea/
162+
.idea/

0 commit comments

Comments
 (0)