-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (72 loc) · 2.18 KB
/
python-publish.yml
File metadata and controls
89 lines (72 loc) · 2.18 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
88
89
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [ published ]
permissions:
contents: read
jobs:
sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version-default
- name: Install dependencies
run: |
python -m pip install -U pip --disable-pip-version-check
python -m pip install setuptools wheel build
- name: Build Package
run: python -m build --sdist
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: ci-sdist
path: dist/*.tar.gz
wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [
ubuntu-latest, ubuntu-24.04-arm,
windows-latest, windows-11-arm,
macos-15-intel, macos-14
]
steps:
- name: Checkout Project
uses: actions/checkout@v5
- name: Set up QEMU
if: runner.os == 'Linux' && runner.arch == 'X64'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v3.2.0
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_ARCHS_LINUX: ${{ runner.arch == 'X64' && 'auto ppc64le s390x' || 'auto' }}
- uses: actions/upload-artifact@v4
with:
name: ci-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
publish:
runs-on: ubuntu-latest
needs: [ sdist, wheels ]
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
pattern: ci-*
path: dist/
merge-multiple: true
- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}