Skip to content

Commit 4d88d7f

Browse files
committed
add github action (deploy.yml)
1 parent 9b52951 commit 4d88d7f

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-wheel-linux:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- uses: RalfG/[email protected]_x86_64
14+
with:
15+
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39'
16+
#build-requirements: 'cython numpy'
17+
system-packages: 'pybind11'
18+
- name: Upload wheel
19+
uses: actions/upload-artifact@v1
20+
with:
21+
name: dist
22+
path: dist
23+
build-wheel-matrix:
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
python-version: [3.7, 3.8, 3.9]
28+
os: [macos-10.14, windows-latest]
29+
30+
runs-on: ${{ matrix.os }}
31+
32+
steps:
33+
- uses: actions/checkout@v1
34+
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v1
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: setup xcode version
41+
if: startsWith(matrix.os, 'macos')
42+
uses: maxim-lobanov/setup-xcode@v1
43+
with:
44+
xcode-version: '10'
45+
- name: Build
46+
run: |
47+
pip install wheel
48+
python setup.py bdist_wheel
49+
- name: Upload wheel
50+
uses: actions/upload-artifact@v1
51+
with:
52+
name: dist
53+
path: dist
54+
55+
deploy:
56+
runs-on: ubuntu-latest
57+
needs: [build-wheel-linux, build-wheel-matrix]
58+
steps:
59+
- name: checkout source code
60+
uses: actions/checkout@v1
61+
- name: Get Branch
62+
run: |
63+
raw=$(git branch -r --contains ${{ github.ref }})
64+
branch=${raw/origin\/}
65+
echo ::set-env name=branch::$branch
66+
- name: Print branch name
67+
run: |
68+
echo ${{ env.branch }}
69+
- name: Load artifacts
70+
uses: actions/download-artifact@v2
71+
with:
72+
name: dist
73+
path: dist
74+
- name: Remove linux_x86_64 wheels
75+
run: rm dist/*-linux_x86_64.whl
76+
- name: Publish distribution package to Test PyPI
77+
uses: pypa/gh-action-pypi-publish@master
78+
with:
79+
user: ${{ secrets.pypi_user }}
80+
password: ${{ secrets.test_pypi_password }}
81+
repository_url: https://test.pypi.org/legacy/
82+
- name: Publish distribution package to PyPI
83+
#if: env.branch == 'master'
84+
uses: pypa/gh-action-pypi-publish@master
85+
with:
86+
user: ${{ secrets.pypi_user }}
87+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)