-
Notifications
You must be signed in to change notification settings - Fork 4
136 lines (122 loc) · 4.16 KB
/
release.yml
File metadata and controls
136 lines (122 loc) · 4.16 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Release CI
on:
# to publish from main branch.
push:
branches: [main]
tags: ['**']
# to verify distributions before merging a PR
pull_request:
branches: [main]
# to manually trigger dry-runs on non-default branches
workflow_dispatch:
env:
ARTIFACT_NAME_PREFIX: 'pyRF24_wheels'
run-name: >-
Release
${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || (github.ref_name != 'main' && '(dry-run)' || github.ref) }}
permissions: {}
jobs:
# sdist for non-supported platforms will serve as a stub lib install
sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout Current Repo
uses: actions/checkout@v6
with:
submodules: true
# non-shallow checkout needed for setuptools_scm
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: build
run: pipx run build -s
- name: Save distributable wheels as artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ env.ARTIFACT_NAME_PREFIX }}_sdist
path: dist
linux:
runs-on: ${{ (matrix.arch == 'aarch64' || matrix.arch == 'armv7l') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
# the intention here is that each wheel is built in a separate job
arch: [x86_64, aarch64, armv7l]
python: [cp39, cp310, cp311, cp312, cp313, cp314, cp314t]
tag: [manylinux, musllinux]
include:
- arch: aarch64
python: pp310
tag: manylinux
- arch: aarch64
python: pp311
tag: manylinux
- arch: x86_64
python: pp310
tag: manylinux
- arch: x86_64
python: pp311
tag: manylinux
steps:
- name: Checkout Current Repo
uses: actions/checkout@v6
with:
submodules: true
# non-shallow checkout needed for setuptools_scm
fetch-depth: 0
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@v3.2.0
with:
output-dir: dist
# see options at https://cibuildwheel.pypa.io/en/stable/options/
env:
# for transparent logs
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: '${{ matrix.python }}-${{ matrix.tag }}_*'
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
- name: Save distributable wheels as artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ env.ARTIFACT_NAME_PREFIX }}_${{ matrix.arch }}_${{ matrix.python }}_${{ matrix.tag }}
path: dist
deploy:
name: >-
Deploy to
${{ startsWith(github.ref, 'refs/tags/') && 'pypi' || 'test-pypi' }}
${{ github.ref_name != 'main' && '(dry run)' || '' }}
needs: [sdist, linux]
permissions:
# needed permission for PyPI "trusted publishing"
id-token: write
runs-on: ubuntu-latest
env:
# to avoid typos, set this here for easy repetition
DEFAULT_BRANCH: 'refs/heads/main'
steps:
- name: Download build artifacts
uses: actions/download-artifact@v7
with:
pattern: ${{ env.ARTIFACT_NAME_PREFIX }}_*
path: dist
merge-multiple: true
# if doing a dry-run (not a tag and not on main branch)
- name: Set up Python
if: github.ref != env.DEFAULT_BRANCH
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Validate distributions
if: github.ref != env.DEFAULT_BRANCH
run: pipx run twine check dist/*
- name: Publish package
# only deploy from the main branch or when a tag is pushed
if: github.ref == env.DEFAULT_BRANCH || startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
# Only upload distributions to PyPI when triggered by a pushed tag.
# Otherwise, upload to test-PyPI for nightly builds on main branch.
repository-url: https://${{ startsWith(github.ref, 'refs/tags/') && 'upload' || 'test' }}.pypi.org/legacy/