Skip to content

Commit 620fe9d

Browse files
committed
add deploy.yml
1 parent 1d74be7 commit 620fe9d

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/deploy.yml

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

0 commit comments

Comments
 (0)