Skip to content

[pre-commit.ci] pre-commit autoupdate (#42) #124

[pre-commit.ci] pre-commit autoupdate (#42)

[pre-commit.ci] pre-commit autoupdate (#42) #124

Workflow file for this run

on:
push:
branches:
- master
tags:
- "v*"
pull_request:
name: Build and release to pypi
permissions:
contents: read
jobs:
release-build:
name: Build and upload distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: |
**/requirements*.txt
**/pyproject.toml
- name: Build dist
run: uv tool run --with build[uv] --from build python -m build --installer uv --sdist
- name: Upload release distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
release-wheel:
name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# linux-64
- os: ubuntu-latest
python: 312
platform_id: manylinux_x86_64
# macos-x86-64
- os: macos-13
python: 312
platform_id: macosx_x86_64
# macos-arm64
- os: macos-14
python: 312
platform_id: macosx_arm64
# win-64
- os: windows-2019
python: 312
platform_id: win_amd64
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: |
**/requirements*.txt
**/pyproject.toml
if: runner.os != 'Linux'
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: all
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_BUILD_FRONTEND: "build[uv]"
- uses: actions/upload-artifact@v4
with:
name: release-cibw-cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
pypi-publish:
name: Release to pypi
runs-on: ubuntu-latest
environment:
name: pypi_publish
url: https://pypi.org/p/python-template
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs:
- release-build
- release-wheel
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: release-*
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1