From 3a9b79ece21252f93bdf62ed2e0be786bf8b7572 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Thu, 28 Jan 2021 18:58:21 +0100 Subject: [PATCH] Also build wheels with cibuildwheel --- .github/workflows/publish-twine.yaml | 58 ++++++++++++++++++++++++---- pyproject.toml | 6 +++ 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-twine.yaml b/.github/workflows/publish-twine.yaml index 05de379..37ccffd 100644 --- a/.github/workflows/publish-twine.yaml +++ b/.github/workflows/publish-twine.yaml @@ -2,10 +2,38 @@ name: Upload Python Package on: release: - types: [created] + types: [published] jobs: - deploy: + 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@v2 + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.x' + + - name: Install cibuildwheel + run: | + python -m pip install --upgrade pip + python -m pip install cibuildwheel + - name: Build wheels + run: | + python -m cibuildwheel --output-dir dist + env: + CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*" + - uses: actions/upload-artifact@v2 + with: + path: dist/*.whl + + build_sdist: + name: Build sdist runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -16,11 +44,25 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools "cython >= 0.28" twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + pip install setuptools "cython >= 0.28" + - name: Build sdist run: | python setup.py sdist - twine upload dist/* + - uses: actions/upload-artifact@v2 + with: + path: dist/* + + publish: + name: Publish to PyPI + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_PASSWORD }} diff --git a/pyproject.toml b/pyproject.toml index 5c80f13..f778c80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,9 @@ +[build-system] +requires = [ + "setuptools", + "Cython", +] + [tool.black] target_version = ["py36"] include = '\.pyi?$'