diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54b5f766..85a3c84e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI tests +name: Run tests and build package on: pull_request: push: @@ -31,11 +31,12 @@ jobs: tests: name: Run tests + needs: linting runs-on: ubuntu-latest strategy: fail-fast: false - max-parallel: 4 + max-parallel: 5 matrix: python-version: [3.7, 3.8, 3.9, 3.10, 3.11] @@ -62,3 +63,27 @@ jobs: run: coveralls --service=github env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-and-push: + name: Build and publish package to PyPI + needs: [linting, tests] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: Build a binary wheel and a source tarball + run: | + python3 -m pip install wheel + python3 setup.py sdist bdist_wheel + + - name: Publish distribution to PyPI (if tagged) + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }}