From b7b966f01cb50d647beaac34747befbc42729e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Thu, 10 Sep 2026 10:52:15 +0200 Subject: [PATCH] Fix publish workflow - `created` event does not fire if release is drafted, then undrafted, but published does - Unrolled the ternary to conditional steps, as evaluation is confusing there. --- .github/workflows/publish.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cfee56e..fd63864 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: PyPI Publish on: release: - types: [created] + types: [published] workflow_dispatch: inputs: test_release: @@ -22,7 +22,16 @@ jobs: enable-cache: true cache-dependency-glob: "uv.lock" - run: uv build - - run: uv publish + + - name: Publish to TestPyPI + if: ${{ github.event_name == 'workflow_dispatch' && inputs.test_release == true }} + run: uv publish + env: + UV_PUBLISH_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} + UV_PUBLISH_URL: https://test.pypi.org/legacy/ + + - name: Publish to PyPI + if: ${{ github.event_name != 'workflow_dispatch' || inputs.test_release == false }} + run: uv publish env: - UV_PUBLISH_TOKEN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test_release && secrets.TEST_PYPI_API_TOKEN || secrets.POETRY_PYPI_TOKEN_PYPI }} - UV_PUBLISH_URL: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test_release && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/' }} + UV_PUBLISH_TOKEN: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}