Skip to content

Build and upload to PyPI #45

Build and upload to PyPI

Build and upload to PyPI #45

# Deploy to pypi for all plattforms
name: Build and upload to PyPI
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ ubuntu-latest, windows-latest, macos-14 ]
# os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-13, macos-14]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
# - name: Install uv
# uses: astral-sh/setup-uv@v7
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.0
env:
CIBW_PLATFORM: ${{ matrix.platform || 'auto' }}
# CIBW_BUILD_FRONTEND: "build[uv]"
- uses: actions/upload-artifact@v7
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy cython build
# - name: Compile cython code
# run: |
# python setup.py build_ext --inplace
# - name: Install avaframe
# run: |
# pip install .
- name: create source distribution
run: python -m build
# - name: Build sdist
# run: pipx run build --sdist
- uses: actions/upload-artifact@v7
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [ build_wheels, build_sdist ]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
# if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v8
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1