Skip to content

Commit 08818e7

Browse files
committed
Deploy to PyPI Github action
1 parent b176074 commit 08818e7

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

.github/workflows/pypi.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Deploy to PyPI
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
macos:
9+
strategy:
10+
matrix:
11+
python-version:
12+
- '3.6'
13+
- '3.7'
14+
- '3.8'
15+
- '3.9'
16+
runs-on: macos-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
architecture: x64
23+
- name: Install Rust toolchain
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: nightly
27+
profile: minimal
28+
override: true
29+
default: true
30+
- name: Build wheels - x86_64
31+
uses: messense/maturin-action@v1
32+
with:
33+
maturin-version: latest
34+
target: x86_64
35+
args: --release --out dist
36+
- name: Build wheels - universal2
37+
uses: messense/maturin-action@v1
38+
with:
39+
args: --release --universal2 --out dist --no-sdist
40+
- name: Upload wheels
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: wheels
44+
path: dist
45+
46+
windows:
47+
runs-on: windows-latest
48+
strategy:
49+
matrix:
50+
target: [x64, x86]
51+
python-version:
52+
- '3.6'
53+
- '3.7'
54+
- '3.8'
55+
- '3.9'
56+
steps:
57+
- uses: actions/checkout@v2
58+
- uses: actions/setup-python@v2
59+
with:
60+
python-version: ${{ matrix.python-version }}
61+
architecture: ${{ matrix.target }}
62+
- name: Install Rust toolchain
63+
uses: actions-rs/toolchain@v1
64+
with:
65+
toolchain: nightly
66+
profile: minimal
67+
override: true
68+
default: true
69+
- name: Build wheels
70+
uses: messense/maturin-action@v1
71+
with:
72+
maturin-version: latest
73+
target: ${{ matrix.target }}
74+
args: --release --out dist --no-sdist
75+
- name: Upload wheels
76+
uses: actions/upload-artifact@v2
77+
with:
78+
name: wheels
79+
path: dist
80+
81+
linux:
82+
runs-on: ubuntu-latest
83+
strategy:
84+
matrix:
85+
target: [x86_64]
86+
python-version:
87+
- '3.6'
88+
- '3.7'
89+
- '3.8'
90+
- '3.9'
91+
steps:
92+
- uses: actions/checkout@v2
93+
- uses: actions/setup-python@v2
94+
with:
95+
python-version: ${{ matrix.python-version }}
96+
architecture: x64
97+
- name: Install Rust toolchain
98+
uses: actions-rs/toolchain@v1
99+
with:
100+
toolchain: nightly
101+
profile: minimal
102+
override: true
103+
default: true
104+
- name: Build Wheels
105+
uses: messense/maturin-action@v1
106+
with:
107+
maturin-version: latest
108+
target: ${{ matrix.target }}
109+
args: --release --out dist --no-sdist
110+
container: off
111+
manylinux: auto
112+
- name: Upload wheels
113+
uses: actions/upload-artifact@v2
114+
with:
115+
name: wheels
116+
path: dist
117+
118+
release:
119+
name: Release
120+
runs-on: ubuntu-latest
121+
if: "startsWith(github.ref, 'refs/tags/')"
122+
needs: [ macos, windows, linux]
123+
steps:
124+
- uses: actions/download-artifact@v2
125+
with:
126+
name: wheels
127+
- uses: actions/setup-python@v2
128+
with:
129+
python-version: 3.9
130+
- name: Publish to PyPi
131+
env:
132+
TWINE_USERNAME: __token__
133+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
134+
run: |
135+
pip install --upgrade twine
136+
twine upload --skip-existing *

0 commit comments

Comments
 (0)