-
Notifications
You must be signed in to change notification settings - Fork 42
91 lines (74 loc) · 2.27 KB
/
Copy pathbuild-python-wheels.yml
File metadata and controls
91 lines (74 loc) · 2.27 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
90
91
# See the Python documentation: https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# and cibuildwheel: https://cibuildwheel.readthedocs.io/en/stable/
name: Build and upload wheels and sdist
on:
push:
tags:
- pyat-[0-9]*
workflow_dispatch:
jobs:
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-15-intel, macos-latest]
steps:
- uses: actions/checkout@v7
with:
# Necessary to fetch tags and allow setuptools_scm
# see: https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@v7
with:
python-version: 3.12
- name: Build wheels
uses: pypa/cibuildwheel@v4.1
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
if-no-files-found: error
build_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# Necessary to fetch tags and allow setuptools_scm
# see: https://github.com/pypa/setuptools_scm/issues/480
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v7
with:
python-version: '3.12'
- name: Install build tools
run: python -m pip install build
- name: Build sdist
run: python -m build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v7
with:
name: tar.gz
path: dist/
if-no-files-found: error
publish-to-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish on tag pushes
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
environment:
name: pypi
url: https://pypi.org/p/accelerator-toolbox
permissions:
id-token: write
steps:
- name: Download all packages
uses: actions/download-artifact@v8
with:
path: dist/
merge-multiple: true
- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true