Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
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
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Check the tag matches package metadata
if: startsWith(github.ref, 'refs/tags/')
run: |
python - <<'PY'
import os, tomllib
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spotify-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 20 additions & 0 deletions docs/release-checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading