docker build branch fix #1819
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 | |
# Build on every branch push, tag push, and pull request change: | |
on: push | |
jobs: | |
build_wheels: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: [3.8] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# This allows the setuptools_scm library to discover the tag version from git | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build wheel | |
run: | | |
pip install --upgrade pip | |
pip install build | |
python -m build --wheel --outdir dist/ . | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: ./dist/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
with: | |
python-version: '3.8' | |
- name: Build sdist | |
run: | | |
pip install --upgrade pip | |
pip install build | |
python -m build --sdist --outdir dist/ . | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: ./dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
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@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} | |
# To test: repository_url: https://test.pypi.org/legacy/ |