1
+ name : Build and upload to PyPI
2
+
3
+ # Build on every branch push, tag push, and pull request change:
4
+ on :
5
+ # Trigger the workflow on push or pull request,
6
+ # but only for the master branch
7
+ push :
8
+ branches :
9
+ - master
10
+ pull_request :
11
+ branches :
12
+ - master
13
+
14
+ jobs :
15
+ build_wheels :
16
+ name : Build wheels on ${{ matrix.os }}
17
+ runs-on : ${{ matrix.os }}
18
+ strategy :
19
+ matrix :
20
+ os : [ubuntu-18.04, windows-latest, macos-latest]
21
+ env :
22
+ CIBW_BUILD : " cp3?-*"
23
+ CIBW_SKIP : " cp33-* cp34-* cp35-*"
24
+ CIBW_BEFORE_BUILD : " python -m pip install -r requirements.txt"
25
+ steps :
26
+ - uses : actions/checkout@v2
27
+ - uses : actions/setup-python@v2
28
+ name : Install Python
29
+ with :
30
+ python-version : ' 3.7'
31
+
32
+ - name : Install cibuildwheel
33
+ run : |
34
+ python -m pip install cibuildwheel==1.5.5
35
+ - name : Build wheels
36
+ run : |
37
+ python -m cibuildwheel --output-dir wheelhouse
38
+ - uses : actions/upload-artifact@v2
39
+ with :
40
+ path : ./wheelhouse/*.whl
41
+
42
+ build_sdist :
43
+ name : Build source distribution
44
+ runs-on : ubuntu-latest
45
+ steps :
46
+ - uses : actions/checkout@v2
47
+
48
+ - uses : actions/setup-python@v2
49
+ name : Install Python
50
+ with :
51
+ python-version : ' 3.7'
52
+
53
+ - name : Build sdist
54
+ run : python setup.py sdist
55
+
56
+ - uses : actions/upload-artifact@v2
57
+ with :
58
+ path : dist/*.tar.gz
59
+
60
+ upload_pypi :
61
+ needs : [build_wheels, build_sdist]
62
+ runs-on : ubuntu-latest
63
+ # upload to PyPI on every release
64
+ if : github.event_name == 'release' && github.event.action == 'published'
65
+ steps :
66
+ - uses : actions/download-artifact@v2
67
+ with :
68
+ name : artifact
69
+ path : dist
70
+
71
+ - uses : pypa/gh-action-pypi-publish@master
72
+ with :
73
+ user : __token__
74
+ password : ${{ secrets.pypi_password }}
0 commit comments