From a45b217409c260a75a10dd62b290ddced74ef0f5 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Thu, 10 Oct 2024 13:29:22 -0600 Subject: [PATCH] add a publish job that upload to pypi/testpypi of a version tag --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5969ff7..9c1020c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,7 +78,7 @@ jobs: pip install nox nox --verbose --force-python=${{ matrix.python-version }} -s test-with-pip -- dist/*.tar.gz - build-with-conda: + test-with-conda: name: Test with conda needs: build-sdist runs-on: ${{ matrix.os }} @@ -119,7 +119,7 @@ jobs: pip install nox nox --verbose --force-python=${{ matrix.python-version }} -s test-with-conda -- dist/*.tar.gz - docs: + build-docs: name: Build the docs needs: check-tag runs-on: ubuntu-latest @@ -139,3 +139,29 @@ jobs: run: | pip install nox nox -s docs + + publish: + needs: + - check-tag + - test-with-pip + - test-with-conda + - build-docs + name: "Publish to PyPI/TestPyPI" + runs-on: ubuntu-latest + + permissions: + id-token: write + + steps: + - uses: actions/download-artifact@v4 + with: + pattern: "build-*" + merge-multiple: true + path: ${{ github.workspace }}/dist + - uses: pypa/gh-action-pypi-publish@release/v1 + if: ${{ startsWith(needs.check-tag.outputs.publish_url, 'http') }} + with: + repository-url: ${{ needs.check-tag.outputs.publish_url }} + skip-existing: true + print-hash: true + verify-metadata: false