From 0987e5444c14a380aed8c9db37690912fac88014 Mon Sep 17 00:00:00 2001 From: Devin Slick Date: Sat, 22 Nov 2025 20:19:42 -0600 Subject: [PATCH 1/2] Only upload to pypi when releases are created --- .github/workflows/publish.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3a5f678..87c094d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,7 @@ name: Publish Python Package -# Trigger on: -# - pushes to main (publish to PyPI after merge) -# - published GitHub Releases (publish to PyPI for versioned releases) +# Trigger only on published GitHub Releases (tagged releases) on: - push: - branches: [main] release: types: [published] @@ -41,17 +37,13 @@ jobs: name: python-package-distributions path: dist/ - # Publish from pushes to main OR when a Release is published -> Production PyPI + # Publish only when a Release is published -> Production PyPI publish_pypi: - name: Publish to PyPI (main branch or GitHub Release) + name: Publish to PyPI (GitHub Release only) runs-on: ubuntu-latest needs: build_sdist_and_wheel - # Run when: - # - push to main branch, or - # - release published event (keeps existing release-based behavior) - if: | - (github.event_name == 'push' && github.ref == 'refs/heads/main') || - (github.event_name == 'release' && github.event.action == 'published') + # Run only when a release is published + if: github.event_name == 'release' && github.event.action == 'published' environment: pypi permissions: id-token: write From ccfae3a5af291db6d9883c2e12816a54956b8192 Mon Sep 17 00:00:00 2001 From: Devin Slick Date: Sat, 22 Nov 2025 20:28:11 -0600 Subject: [PATCH 2/2] Simply release workflow --- .github/workflows/publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 87c094d..aa0f08c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,8 +42,6 @@ jobs: name: Publish to PyPI (GitHub Release only) runs-on: ubuntu-latest needs: build_sdist_and_wheel - # Run only when a release is published - if: github.event_name == 'release' && github.event.action == 'published' environment: pypi permissions: id-token: write