-
Notifications
You must be signed in to change notification settings - Fork 6
87 lines (85 loc) · 2.58 KB
/
ci.yml
File metadata and controls
87 lines (85 loc) · 2.58 KB
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
name: CI
# Events that trigger workflow
on:
push:
branches:
- "*"
pull_request:
jobs:
build_wheels:
name: Build Wheels (${{matrix.os.name}})
runs-on: ${{ matrix.os.runner }}
strategy:
matrix:
os:
[
{
name: "Ubuntu 20.04",
runner: "ubuntu-20.04",
archs: "x86_64,aarch64",
},
{ name: "macOS 11", runner: "macos-11", archs: "x86_64,arm64" },
{
name: "Windows Server 2019",
runner: "windows-2019",
archs: "AMD64,ARM64",
},
]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- if: ${{ matrix.os.runner == 'ubuntu-20.04' }}
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- uses: actions/setup-python@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.15.0
- name: Build wheels
run: python -m cibuildwheel --archs ${{ matrix.os.archs }} --output-dir dist
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.whl
push_to_pypi:
name: Build (and publish, if applicable)
runs-on: ubuntu-20.04
needs: build_wheels
steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Export Repo URL
run: echo "REPO_URL=https://github.com/${{ github.repository }}" >> $GITHUB_ENV
- name: Export Branch Name
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.6"
- name: Build Distribution
run: |
python3 ./setup.py sdist
- uses: actions/download-artifact@v3
with:
path: .
- run: mv ./artifact/* ./dist
- name: Set default for env.NEW_TAG
run: echo "NEW_TAG=NO_NEW_TAG" >> $GITHUB_ENV
- name: Check for new version
if: ${{ env.BRANCH_NAME == 'main' }}
run: |
cd ${GITHUB_WORKSPACE}/ && python3 .github/scripts/generate_tag.py
- name: Tag Commit
if: ${{ env.NEW_TAG != 'NO_NEW_TAG' }}
uses: tvdias/github-tagger@v0.0.1
with:
tag: "${{ env.NEW_TAG }}"
repo-token: "${{ secrets.MY_TOKEN }}"
- name: Publish
if: ${{ env.NEW_TAG != 'NO_NEW_TAG' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}