Merge pull request #23 from synodriver/main #115
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and upload to PyPI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+*" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Optional, use if you use setuptools_scm https://stackoverflow.com/a/68959339 | |
submodules: true # Optional, use if you have submodules | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install pypa/build | |
run: pip install build | |
- name: Build sdist *and* wheel (even though we ignore it) to check we can confirm wheels from source. | |
run: USE_CYTHON=1 python -m build | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: dist/*.tar.gz | |
build_wheels: | |
needs: build_sdist | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macos-12] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Optional, use if you use setuptools_scm https://stackoverflow.com/a/68959339 | |
submodules: true # Optional, use if you have submodules | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: ./wheelhouse/*.whl | |
create_release: | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/* | |
upload_pypi: | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |