Skip to content

Merge pull request #349 from CITCOM-project/f-allian-patch-1 #85

Merge pull request #349 from CITCOM-project/f-allian-patch-1

Merge pull request #349 from CITCOM-project/f-allian-patch-1 #85

name: Publish to PyPI
on:
push:
tags:
- v*
jobs:
# First job is to build the wheels on different OS
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Upgrade pip and install cibuildwheel
run: |
python -m pip install --upgrade pip
pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: "cp310-* cp311-* cp312-*"
CIBW_SKIP: "pp* *musllinux*"
CIBW_TEST_SKIP: "*"
CIBW_ARCHS_MACOS: "universal2"
CIBW_ARCHS_LINUX: "x86_64 aarch64"
- name: Upload built wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
# Then just build the source distribution as normal
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Upgrade pip and install build
run: |
python -m pip install --upgrade pip
pip install build
- name: Build sdist
run: python -m build --sdist --outdir dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
# Finally publish all files to PyPI
publish:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Merge all distributions
run: |
mkdir -p final_dist
find dist -name '*.whl' -exec cp {} final_dist/ \;
find dist -name '*.tar.gz' -exec cp {} final_dist/ \;
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: final_dist