-
Notifications
You must be signed in to change notification settings - Fork 65
114 lines (100 loc) · 2.9 KB
/
wheels.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
name: Wheels
on:
pull_request:
branches:
- master
paths:
- ".github/workflows/wheels.yml"
- "source/**"
release:
types: [published]
concurrency:
group: wheels-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
build-wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-2022
- ubuntu-22.04
- macos-14
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup cibuildwheel
run: |
pipx install cibuildwheel
- name: Build wheels
run: |
cibuildwheel --output-dir wheelhouse
working-directory: python
env:
CIBW_ARCHS: ${{ github.event_name == 'release' && 'auto' || 'auto64' }}
CIBW_BUILD: ${{ github.event_name == 'release' && 'cp312-*' || 'cp312-macosx* cp312-win* cp312-manylinux*' }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: cppbinder-wheels
path: ./python/wheelhouse/*.whl
- name: Upload wheels to release
if: github.event_name == 'release'
shell: bash
run: |
gh release upload ${{ github.ref_name }} ./python/wheelhouse/*.whl --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-sdist:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build source distribution
run: |
python -m build --sdist --outdir dist
working-directory: python
- uses: actions/upload-artifact@v4
if: always()
with:
name: cppbinder-sdist
path: ./python/dist/*.tar.gz
- name: Upload wheels to release
if: github.event_name == 'release'
run: |
gh release upload ${{ github.ref_name }} ./python/dist/*.tar.gz --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
needs: [build-wheels, build-sdist]
if: github.event_name == 'release'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download wheels
run: |
gh release download ${{ github.ref_name }} --pattern *.whl --pattern *.tar.gz --dir dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist