-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (106 loc) · 2.97 KB
/
python-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# This workflows will upload a Python Package using Twine when a release is created
name: build
on:
push:
tags:
- 'v*'
jobs:
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools numpy
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*.tar.gz
build-linux-wheels:
name: Build Linux wheels
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.5, 3.6, 3.7, 3.8 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build
run: |
python setup.py bdist_wheel
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/saber-*.whl
build-macos-wheels:
name: Build MacOS wheels
runs-on: macos-latest
strategy:
matrix:
python-version: [ 3.5, 3.6, 3.7 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel numpy cython
- name: Build wheels
run: |
python setup.py bdist_wheel
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/saber-*-macosx*.whl
create-release:
needs: [ build-sdist, build-linux-wheels, build-macos-wheels ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Create GitHub Release
uses: docker://antonyurchenko/git-release:v3.4.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "false"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_TAG_PREFIX: "true"
with:
args: |
dist/*
publish-to-pypi:
needs: [ build-sdist, build-linux-wheels, build-macos-wheels, create-release ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true