Skip to content

Commit 8bd0861

Browse files
committed
Add automated release process
1 parent f3a9592 commit 8bd0861

File tree

2 files changed

+71
-50
lines changed

2 files changed

+71
-50
lines changed

.github/workflows/build.yml

-50
This file was deleted.

.github/workflows/main.yml

+71
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- '**'
79
pull_request:
810

911
concurrency:
@@ -90,3 +92,72 @@ jobs:
9092
with:
9193
name: html-report
9294
path: htmlcov
95+
96+
build:
97+
name: Build wheels on ${{ matrix.os }}
98+
if: >
99+
startsWith(github.ref, 'refs/tags/') ||
100+
github.ref == 'refs/heads/main' ||
101+
contains(github.event.pull_request.labels.*.name, 'Build')
102+
103+
strategy:
104+
matrix:
105+
os:
106+
- linux
107+
- macos
108+
- windows
109+
110+
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu-24.04') || (matrix.os == 'macos' && 'macos-14') || (matrix.os == 'windows' && 'windows-2022') || 'unknown' }}
111+
112+
env:
113+
CIBW_ARCHS_LINUX: x86_64 i686 aarch64
114+
CIBW_ARCHS_MACOS: x86_64 universal2
115+
CIBW_ARCHS_WINDOWS: AMD64 x86 ARM64
116+
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
117+
118+
steps:
119+
- uses: actions/checkout@v4
120+
121+
- uses: astral-sh/setup-uv@v3
122+
123+
- name: Set up QEMU
124+
uses: docker/setup-qemu-action@v3
125+
if: matrix.os == 'linux'
126+
with:
127+
platforms: all
128+
129+
- name: Build sdist
130+
if: ${{ matrix.os == 'linux' }}
131+
run: uv build --sdist
132+
133+
- name: Build wheels
134+
run: uvx --from cibuildwheel==2.20.0 cibuildwheel --output-dir dist
135+
136+
- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/
137+
138+
- uses: actions/upload-artifact@v4
139+
with:
140+
name: dist-${{ matrix.os }}
141+
path: dist
142+
143+
release:
144+
needs: [coverage, build]
145+
if: success() && startsWith(github.ref, 'refs/tags/')
146+
runs-on: ubuntu-24.04
147+
environment: release
148+
149+
permissions:
150+
contents: read
151+
id-token: write
152+
153+
steps:
154+
- uses: actions/checkout@v4
155+
156+
- name: get dist artifacts
157+
uses: actions/download-artifact@v4
158+
with:
159+
merge-multiple: true
160+
pattern: dist-*
161+
path: dist
162+
163+
- uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)