Skip to content

[upload-to-pypi]

[upload-to-pypi] #98

name: Upload package to Pypi
on:
push:
branches:
- '**'
jobs:
make_sdist:
if: contains(github.event.head_commit.message, '[upload-to-test-pypi]')
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install deps
run: python -m pip install build twine
- name: Build SDist
run: python -m build --sdist
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
- name: Check metadata
run: twine check dist/*
build_wheels:
if: contains(github.event.head_commit.message, '[upload-to-test-pypi]')
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- uses: actions/setup-python@v2
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
env:
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_*"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_LINUX: "auto aarch64"
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl
upload_all:
if: contains(github.event.head_commit.message, '[upload-to-test-pypi]')
needs: [build_wheels, make_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/