From 2d59c237c2d46b1b11deabf8e6cdffadbe319c3d Mon Sep 17 00:00:00 2001 From: Aran <96021763+Aran404@users.noreply.github.com> Date: Sat, 21 Nov 2026 22:21:30 -0500 Subject: [PATCH 1/3] Run exact PyPI release preflight on PR and main; publish only tags --- .github/workflows/publish.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index eb2a7a0..c575862 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,17 @@ -name: Publish a tagged release +name: Release preflight and PyPI publish +# PRs and main use the SAME build/test environment as tagged releases. +# Only a version-tag push is allowed to upload to PyPI. on: + pull_request: push: + branches: [main] tags: ["v*"] + workflow_dispatch: jobs: build: + name: Release preflight (publish environment) runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -13,6 +19,7 @@ jobs: with: python-version: "3.11" - name: Check the tag matches package metadata + if: startsWith(github.ref, 'refs/tags/') run: | python - <<'PY' import os, tomllib @@ -61,6 +68,8 @@ jobs: path: dist/ publish: + # Never publish from a PR, main-branch push, or manual dry run. + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') needs: build runs-on: ubuntu-latest environment: pypi From 6b8a656854021b668b6e2ab5840ae1062c830ab0 Mon Sep 17 00:00:00 2001 From: Aran <96021763+Aran404@users.noreply.github.com> Date: Sat, 21 Nov 2026 22:21:54 -0500 Subject: [PATCH 2/3] Document exact release preflight and honest live-test gates --- docs/release-checks.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/release-checks.md b/docs/release-checks.md index 1f42661..23485a0 100644 --- a/docs/release-checks.md +++ b/docs/release-checks.md @@ -39,6 +39,20 @@ The [CI workflows](https://github.com/Aran404/SpotAPI/tree/main/.github/workflow exercise offline contracts across Python 3.11-3.13 and supported desktop OSes, plus wheel installation checks and frontend browser tests. +**Publishing preflight:** The [release workflow](https://github.com/Aran404/SpotAPI/actions/workflows/publish.yml) +also runs its **exact tagged-release build and test steps** on every pull request and +every push to `main`. This matters because `build` and `twine` introduce dependencies +that the ordinary development test environment might not have. It builds and checks +the distributions, installs the wheel, and smoke-tests it outside the checkout. +The PyPI upload job is **skipped** unless the event is a matching `v*` tag push. + +Before tagging, verify a **successful release preflight on the exact `main` commit** +you plan to tag, not just the separate cross-platform checks. You can also run the +release workflow manually for a non-publishing preflight. After pushing the tag, +verify that the tagged run's **publish** job succeeds and that the new version +actually appears on [PyPI](https://pypi.org/project/spotapi/). A GitHub release +entry is not proof that PyPI was updated. + ## Live checks Most tests run without a Spotify account or a network connection. The opt-in @@ -49,6 +63,12 @@ checks require credentials supplied only in your own environment. python -m pytest --live=read -m "live and not authenticated" -vv ``` +The scheduled public checks exercise Spotify's actual read-only endpoints. +They do **not** run on ordinary pull requests and can still miss changes to +uncovered endpoints. A manually dispatched authenticated check requires a +configured `SPOTIFY_CANARY_COOKIE` secret; missing credentials cause that check +to fail explicitly, rather than report a misleading success. + Playback-changing tests are **not** part of scheduled public CI. To verify controls on your own device, see the procedure in [Player controls](player.md). Those tests may temporarily change your active playback and should be run only From b65dcb738b59c7ceae336eee1cd28663f603a026 Mon Sep 17 00:00:00 2001 From: Aran <96021763+Aran404@users.noreply.github.com> Date: Sat, 21 Nov 2026 22:22:07 -0500 Subject: [PATCH 3/3] Fail manual account checks explicitly when secret is missing --- .github/workflows/spotify-public.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/spotify-public.yml b/.github/workflows/spotify-public.yml index e38cde8..c924a53 100644 --- a/.github/workflows/spotify-public.yml +++ b/.github/workflows/spotify-public.yml @@ -102,8 +102,8 @@ jobs: SPOTIFY_COOKIE: ${{ secrets.SPOTIFY_CANARY_COOKIE }} run: | if [ -z "$SPOTIFY_COOKIE" ]; then - echo "::notice::Authenticated canary skipped because SPOTIFY_CANARY_COOKIE is not configured." - exit 0 + echo "::error::Authenticated read check cannot run: configure SPOTIFY_CANARY_COOKIE in repository secrets." + exit 1 fi python -m pytest --live=read -m "live and authenticated and not mutates" -vv -rs