Skip to content

Commit

Permalink
Add automated release process
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Oct 8, 2024
1 parent f3a9592 commit 8bd0861
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 50 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/build.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- '**'
pull_request:

concurrency:
Expand Down Expand Up @@ -90,3 +92,72 @@ jobs:
with:
name: html-report
path: htmlcov

build:
name: Build wheels on ${{ matrix.os }}
if: >
startsWith(github.ref, 'refs/tags/') ||
github.ref == 'refs/heads/main' ||
contains(github.event.pull_request.labels.*.name, 'Build')
strategy:
matrix:
os:
- linux
- macos
- windows

runs-on: ${{ (matrix.os == 'linux' && 'ubuntu-24.04') || (matrix.os == 'macos' && 'macos-14') || (matrix.os == 'windows' && 'windows-2022') || 'unknown' }}

env:
CIBW_ARCHS_LINUX: x86_64 i686 aarch64
CIBW_ARCHS_MACOS: x86_64 universal2
CIBW_ARCHS_WINDOWS: AMD64 x86 ARM64
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"

steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: matrix.os == 'linux'
with:
platforms: all

- name: Build sdist
if: ${{ matrix.os == 'linux' }}
run: uv build --sdist

- name: Build wheels
run: uvx --from cibuildwheel==2.20.0 cibuildwheel --output-dir dist

- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/

- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: dist

release:
needs: [coverage, build]
if: success() && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-24.04
environment: release

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: get dist artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: dist-*
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 8bd0861

Please sign in to comment.