From 37ef8c2f5f6efbffb871d9e7258b227cfaae5660 Mon Sep 17 00:00:00 2001 From: Antoine Meillet Date: Mon, 5 Jul 2021 13:44:14 +0200 Subject: [PATCH] Distinct TestPyPI and PyPI deploy jobs (#5) Failure on TestPyPI impacted the run of the PyPI job. --- .github/workflows/ci.yaml | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5f75636..9919139 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,11 +31,10 @@ jobs: # https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ build-publish: - name: Build and publish Python distributions to TestPyPI and PyPI + name: Publish Python distributions to TestPyPI runs-on: ubuntu-latest needs: run-tests # only run when tests where successful - continue-on-error: true - if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') + if: github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v2 @@ -49,13 +48,31 @@ jobs: - name: Build a binary wheel and a source tarball run: | python -m build --sdist --wheel --outdir dist/ . - - name: Publish distribution 📦 to Test PyPI + - name: Publish distribution to TestPyPI uses: pypa/gh-action-pypi-publish@v1.4.2 with: password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/ - - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') + + build-publish-tags: + name: Publish Python distributions to PyPI + runs-on: ubuntu-latest + needs: run-tests # only run when tests where successful + if: startsWith(github.ref, 'refs/tags') + + steps: + - uses: actions/checkout@v2 + - name: Setup Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install pypa/build + run: | + python -m pip install build --user + - name: Build a binary wheel and a source tarball + run: | + python -m build --sdist --wheel --outdir dist/ . + - name: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@v1.4.2 with: password: ${{ secrets.PYPI_API_TOKEN }}