From f73ef366739644bfd9c3f0aaae3ed623f1eed6c0 Mon Sep 17 00:00:00 2001 From: alphasentaurii Date: Wed, 3 Apr 2024 17:44:19 -0400 Subject: [PATCH] separate pypi and testpypi jobs --- .github/workflows/publish_to_pypi.yml | 52 +++++++++++++++++---------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml index ae772bd..28fd471 100644 --- a/.github/workflows/publish_to_pypi.yml +++ b/.github/workflows/publish_to_pypi.yml @@ -36,28 +36,41 @@ jobs: shell: 'bash' run: python -m build --sdist --wheel . - - uses: actions/upload-artifact@v3.1.2 + - uses: actions/upload-artifact@v4 with: path: dist/* + publish_testpypi: + needs: [ build_artifacts ] + runs-on: ubuntu-latest + permissions: + id-token: write + if: ${{ inputs.test }} + steps: + - uses: actions/download-artifact@v4 + with: + name: artifact + path: dist + + - name: Publish package distributions to TEST PyPI + uses: pypa/gh-action-pypi-publish@v1.8.10 + with: + name: testpypi + user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }} + password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER_TEST }} + repository-url: https://test.pypi.org/legacy/ + verify-metadata: true + skip-existing: false + verbose: true + publish_pypi: needs: [ build_artifacts ] runs-on: ubuntu-latest - env: - name: pypi - url: https://pypi.org/project/spacekit - user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }} - password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER }} - test_password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER_TEST }} - test_url: https://test.pypi.org/legacy/ - verify_metadata: true - skip_existing: false - verbose: true permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + if: ${{ inputs.test == 'false' }} steps: - # retrieve your distributions here - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: artifact path: dist @@ -65,9 +78,10 @@ jobs: - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@v1.8.10 with: - user: ${{ env.user }} - password: ${{ (inputs.test == 'true' && env.test_password) || env.password }} - repository-url: ${{ (inputs.test == 'true' && env.test_url) || env.url }} - verify-metadata: ${{ env.verify_metadata }} - skip-existing: ${{ env.skip_existing }} - verbose: ${{ env.verbose }} \ No newline at end of file + name: pypi + user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }} + password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER }} + repository-url: https://pypi.org/p/spacekit + verify-metadata: true + skip-existing: false + verbose: false