From 6ee89705bd565c629a5d360428347bb3b4a62fab Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Wed, 25 Jan 2023 12:54:20 +0100 Subject: [PATCH] actions: also publish to testpypi As described in [1], publish every commit to testpypi and only publish tags to main pypi. [1]: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#publishing-the-distribution-to-pypi-and-testpypi Signed-off-by: Rouven Czerwinski --- .github/workflows/build-and-release.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index b8d9362a2..c81074459 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -16,7 +16,14 @@ jobs: - name: Build sdist run: | python -m build -s - - name: Publish package + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: startsWith(github.ref, 'refs/tags') != true + 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') uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }}