-
Notifications
You must be signed in to change notification settings - Fork 95
92 lines (75 loc) · 2.53 KB
/
release.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
name: Release
on: [push, pull_request]
jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build distribution
run: |
export RELEASE_VERSION=${{ github.ref_name }}
pip install numpy cython
pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
name: dist-artifacts
path: dist/*.tar.gz
# adapted from
# https://github.com/biopython/biopython/blob/master/.github/workflows/ci.yml
build_wheels:
name: Build wheels (py ${{ matrix.pyver }}) ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
pyver: ["37", "38", "39", "310", "311"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Python packaging tools
run: |
export RELEASE_VERSION=${{ github.ref_name }}
pip install numpy cython
python -m pip install --upgrade pip setuptools wheel
# https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
- name: Build wheels (py ${{ matrix.pyver }}) Linux
if: matrix.os == 'ubuntu-latest'
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_SKIP: "*-musllinux*"
CIBW_BUILD: "cp${{ matrix.pyver }}-*"
uses: pypa/[email protected]
- name: Build wheels (py ${{ matrix.pyver }}) MacOS
if: matrix.os == 'macos-latest'
env:
CIBW_ARCHS_MACOS: "x86_64 arm64 universal2"
CIBW_BUILD: "cp${{ matrix.pyver }}-*"
uses: pypa/[email protected]
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: dist-artifacts
path: ./wheelhouse/*.whl
release:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# this is not ideal as it doesn't limit to what type of tag
# but it at least seems to work
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- name: Stage artifacts
uses: actions/download-artifact@v3
with:
name: dist-artifacts
path: dist/
- name: Check artifacts
run: ls -lrt dist/
- name: Publish a Python distribution to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}