Skip to content

Build and upload to PyPI #73

Build and upload to PyPI

Build and upload to PyPI #73

Workflow file for this run

name: Build and upload to PyPI
on:
release:
types: [published]
push:
tags:
- '*'
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
#os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
- name: Set CIBW_ENVIRONMENT
run: |
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/tags/'* ]]; then
echo "Setting CIBW_ENVIRONMENT_DEBUG for 1"
echo "CIBW_ENVIRONMENT_DEBUG=1" >> $GITHUB_ENV
else
echo "Setting CIBW_ENVIRONMENT_DEBUG for 0"
echo "CIBW_ENVIRONMENT_DEBUG=0" >> $GITHUB_ENV
fi
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BEFORE_ALL_MACOS: >
uname -a && cmake --version &&
python -m pip install --upgrade setuptools
CIBW_BEFORE_ALL_LINUX: >
cmake --version &&
yum install -y python3-devel python-devel
CIBW_BEFORE_BUILD: >
pip install pybind11 ninja
CIBW_ARCHS_LINUX: auto, aarch64
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build sdist
run: |
pwd
pipx run build --sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.4.2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- uses: pypa/gh-action-pypi-publish@v1.4.2
if: github.event_name == 'release' && github.event.action == 'published'
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true