Skip to content

Fix update check to read latest version from GitHub directly#41

Open
aboullaite wants to merge 2 commits into
mainfrom
maboullaite/fix-update-check-github
Open

Fix update check to read latest version from GitHub directly#41
aboullaite wants to merge 2 commits into
mainfrom
maboullaite/fix-update-check-github

Conversation

@aboullaite

Copy link
Copy Markdown
Collaborator

Summary

  • The CLI's update command was checking the backend API (/api/v1/cli/releases/latest) for the latest version, but the backend reads from a GCS object (gs://sts-image-uploads/cli/latest.txt) that the release pipeline never updates — it was stuck at 0.1.0-rc.7.
  • Switch the primary version source to the GitHub Releases API, keeping the backend as a fallback.
  • This also removes the auth requirement for update checks (GitHub's public API doesn't need a token).

Root cause

The release workflow (release.yml) creates GitHub releases but never writes the version to GCS or Artifactory. The GCS object was last updated during the pre-release phase and has been stale since stable releases started.

What changed

  • config/config.go: Added GitHubReleasesURL var (resolved at init, overridable via SAVE_TO_SPOTIFY_GITHUB_RELEASES_URL)
  • cmd/update.go: fetchLatestVersion() now tries GitHub first (fetchFromGitHub), falls back to the backend (fetchFromBackend). Extracted validatedVersion() helper to deduplicate version validation.
  • Tests: Updated to mock the GitHub API response format

Test plan

  • All existing tests pass (go test ./...)
  • New TestFetchLatestVersionFallsBackToBackend verifies fallback behavior
  • TestFetchLatestVersionReturnsAssetURL verifies asset matching from GitHub response
  • Manual: run save-to-spotify update --check and verify it reports the correct latest version

Mohammed Aboullaite added 2 commits June 12, 2026 19:41
The CLI's update check was going through the backend API, which reads
the latest version from a GCS object that the release pipeline never
updates. This caused `save-to-spotify update` to report "Already up
to date" even when newer versions exist on GitHub.

Switch the primary version source to the GitHub Releases API, with
the backend as a fallback. This also removes the auth requirement
for update checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant