From edc4f3440d37f4f26a87faf63efbece543c060a9 Mon Sep 17 00:00:00 2001 From: mcflugen Date: Sun, 29 Mar 2026 18:03:44 -0600 Subject: [PATCH] publish to pypi/testpypi on manual trigger --- .github/workflows/test.yml | 44 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 08a8d14..defdce4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,23 @@ name: Test -on: [push, pull_request] +on: + pull_request: + push: + branches: ["**"] + workflow_dispatch: + inputs: + publish_to: + description: Where to publish + type: choice + required: true + default: none + options: + - none + - testpypi + - pypi jobs: - build-and-test: + test: # We want to run on external PRs, but not on our own internal PRs as they'll be run # by the push to the branch. Without this if check, checks are duplicated since # internal PRs match both the push and pull_request events. @@ -39,3 +53,29 @@ jobs: uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} + + publish: + needs: [test] + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' && inputs.publish_to != 'none' + env: + REPOSITORY_URL: ${{ inputs.publish_to == 'testpypi' && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }} + + permissions: + id-token: write + + steps: + - uses: actions/download-artifact@v8 + with: + pattern: build-* + merge-multiple: true + path: ${{ github.workspace }}/dist + + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: ${{ env.REPOSITORY_URL }} + packages-dir: dist + skip-existing: true + print-hash: true + verify-metadata: false