Publish #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build_sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: 3.11 | |
- name: Build source distribution | |
run: uv build --sdist | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-sdist | |
path: dist/*.tar.gz | |
build_wheels: | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] # Add more versions as needed | |
os: [ubuntu-latest, macos-latest, windows-latest, macos-13] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Install uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install the project | |
run: uv sync --all-extras --dev | |
- name: Run tests | |
run: pytest . -vv | |
- name: Lint with Black | |
run: black --check . | |
- name: Build wheels | |
run: uv build --wheel | |
env: | |
CIBW_SKIP: pp* cp27* cp34* cp35* cp36* cp37* cp38* cp39* | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }} | |
path: dist/*.whl | |
publish: | |
needs: [build_sdist, build_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist/ | |
- name: Install uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: 3.11 | |
- name: Publish to PyPI | |
run: uv publish |