-
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.23 KB
/
build-and-publish.yml
File metadata and controls
85 lines (71 loc) · 2.23 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
# THIS WORKFLOW WILL BUILD WHEELS FOR ALL MAJOR PLATFORMS AND UPLOAD THEM TO PYPI
# TO BUILD AND INSTALL LOCALLY FOR TESTING, RUN THE FOLLOWING COMMAND:
# py -m pip install "/path/to/python-lib-xulbux" --no-deps --no-cache-dir --force-reinstall -vv
# TO CREATE A NEW RELEASE, TAG A COMMIT WITH THE FOLLOWING FORMAT:
# git tag v1.X.Y
# git push origin v1.X.Y
# IF THE TAG v1.X.Y ALREADY EXISTS, RUN THE FOLLOWING COMMANDS FIRST:
# git tag -d v1.X.Y
# git push origin :refs/tags/v1.X.Y
name: Build and Publish
permissions:
contents: read
on:
push:
tags:
- "v1.[0-9]+.[0-9]+"
workflow_dispatch: # ALLOW MANUAL TRIGGER
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v6
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-* cp314-*
CIBW_SKIP: "*-musllinux_*"
CIBW_BUILD_FRONTEND: pip
CIBW_ENVIRONMENT: XULBUX_USE_MYPYC=1
- name: Verify wheels were built
run: |
ls -la ./wheelhouse/
if [ -z "$(ls -A ./wheelhouse/)" ]; then
echo "[ERROR] No wheels were built!"
exit 1
fi
echo "[SUCCESS] Built $(ls ./wheelhouse/*.whl | wc -l) wheels."
shell: bash
- uses: actions/upload-artifact@v6
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v6
with:
name: sdist
path: dist/*.tar.gz
upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v7
with:
pattern: "*"
merge-multiple: true
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1