-
Notifications
You must be signed in to change notification settings - Fork 2
170 lines (140 loc) · 4.67 KB
/
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Publish
on: [push]
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macOS-10.15, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Version
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=$(echo $GITHUB_REF | sed -E 's/[^0-9]//g')
PLACEHOLDER="0\+develop"
VERSION_FILE='idi/__init__.py'
sed -E -i'.original' -e "s/(__version__ ?=.*)$PLACEHOLDER/\1$VERSION/g" "$VERSION_FILE"
cat "$VERSION_FILE"
shell: bash
# Used to host cibuildwheel
- uses: actions/setup-python@v2
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.10.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
env:
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
CIBW_REPAIR_WHEEL_COMMAND_LINUX: ""
CIBW_ARCHS: "auto64"
CIBW_BUILD_VERBOSITY: 1
#CIBW_SKIP: pp*
CIBW_BUILD: cp37-* cp38-* cp39-*
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./wheelhouse/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Version
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=$(echo $GITHUB_REF | sed -E 's/[^0-9]//g')
PLACEHOLDER="0\+develop"
VERSION_FILE='idi/__init__.py'
sed -E -i'.original' -e "s/(__version__ ?=.*)$PLACEHOLDER/\1$VERSION/g" "$VERSION_FILE"
cat "$VERSION_FILE"
shell: bash
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
- name: Install numpy and cython
run: python -m pip install numpy cython
- name: Build sdist
run: python setup.py sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload_pypi:
needs: [build_sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- run: ls -R dist
- run: rm -f dist/*.whl
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
#password: ${{ secrets.TEST_PYPI_TOKEN }}
#repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.PYPI_TOKEN }}
build_conda:
name: Upload to Anaconda
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macOS-10.15, windows-latest]
defaults:
run:
shell: bash -l {0}
needs: [build_wheels]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Version
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=$(echo $GITHUB_REF | sed -E 's/[^0-9]//g')
PLACEHOLDER="0\+develop"
VERSION_FILE='idi/__init__.py'
sed -E -i'.original' -e "s/(__version__ ?=.*)$PLACEHOLDER/\1$VERSION/g" "$VERSION_FILE"
cat "$VERSION_FILE"
shell: bash
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: dist
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: "build"
python-version: '3.7'
- run: conda install anaconda-client conda-build -y
- run: ls -R dist
- name: Build packages
run: |
conda install anaconda-client conda-build -y
python .github/conda/wheel2conda.py dist/artifact
- run: ls -R dist
- name: Upload
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
run: anaconda upload dist/artifact/output/*.tar.bz2 --force