Skip to content

Fix release asset ordering so the in-app updater fetches the APK - #686

Merged
kasnder merged 2 commits into
masterfrom
claude/build-sign-script-ordering-7r2097
Jul 28, 2026
Merged

Fix release asset ordering so the in-app updater fetches the APK#686
kasnder merged 2 commits into
masterfrom
claude/build-sign-script-ordering-7r2097

Conversation

@kasnder

@kasnder kasnder commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #681. The GitHub API returns release assets sorted alphabetically by
name, not by upload order — confirmed by inspecting the existing
2026072701 release, whose assets came back as BUILD-INFO.txt,
SHA256SUMS.txt, TrackerControl-githubRelease-latest.apk (alphabetical),
even though build_and_sign.sh lists the APK first on the gh release create command line.

The app's update checker (ServiceSinkhole#checkUpdate,
app/src/main/java/eu/faircode/netguard/ServiceSinkhole.java:809) always
downloads assets[0]:

JSONObject jasset = jassets.getJSONObject(0);

So once scripts/build_and_sign.sh started attaching SHA256SUMS.txt and
BUILD-INFO.txt alongside the signed APK, the updater could end up pointed
at a metadata file instead of the APK.

  • scripts/build_and_sign.sh: rename the metadata assets to
    TrackerControl-githubRelease-latest.apk.sha256sums and
    TrackerControl-githubRelease-latest.apk.build-info.txt. Using the APK
    filename as a literal prefix guarantees the APK sorts first under any
    lexicographic comparison (a string is always ordered before any longer
    string it's a strict prefix of), regardless of case-folding rules — so
    this holds even if GitHub's actual sort semantics change.
  • docs/RELEASING.md: updated the documented asset list and noted why the
    naming matters.

Test plan

  • bash -n scripts/build_and_sign.sh
  • Verified against the live 2026072701/2026072702 release asset
    data via the GitHub API that assets are sorted by name.
  • Next real release: confirm the draft release's asset order shows the
    APK first and the in-app updater picks it up.

Generated by Claude Code

claude added 2 commits July 28, 2026 06:54
GitHub's API returns release assets sorted by name, not upload order.
The app's checkUpdate() always downloads assets[0], so once
build_and_sign.sh started attaching SHA256SUMS.txt and BUILD-INFO.txt
alongside the APK, those alphabetically-earlier names could be picked
up instead of the APK (#681). Rename the metadata files using the APK
filename as a literal prefix so it always sorts first.
checkUpdate() already opened the release's html_url (the GitHub
release page) rather than a direct asset link, so tapping the
notification was never downloading a raw file. But its title used the
first release asset's filename, which is confusing and, per #681,
could be a metadata file rather than the APK depending on asset
ordering. Use the release's display name (e.g. "Version 2026072702")
instead, falling back to a formatted tag if the release has no name.
@kasnder
kasnder marked this pull request as ready for review July 28, 2026 07:04
@kasnder
kasnder merged commit fe8936f into master Jul 28, 2026
2 checks passed
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.

GitHub updater fetches wrong file if multiple files are around

2 participants