fix(ci): no 404 window when a test build is replaced; merged PRs keep their build until Preview has it (#2635)

* fix(ci): a test build's files outlive the catalog that names them, and a merged PR's build lasts until Preview carries it

- A new push's PR release keeps the previous push's files until the catalog names the new
  ones, then five minutes more, so a download started from the old catalog still finds its APK.
  The app also reloads the catalog and retries once when a test build's download fails.
- Closing a PR without merging still deletes its test build. A merged PR's build stays, and
  stays listed, until the newest Preview build was built from a main holding the merge, or
  three days pass (docs-only merges build no Preview). Main's build, the PR cleanup and the
  sweep share one script for this.

* fix(ci): name the current push's APK in the catalog and prune nothing it still names

* fix(ci): only a Preview with every APK carries a merge or is offered

* fix(ci): publish no preview while none has every APK

* test(ci): build_catalog publishes no preview while its APKs are uploading
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-14 23:40:08 -05:00
1 parent 059711cfe1
commit 6f7d7f827f
9 files changed
+336 -72

No files matched your search

@@ -96,7 +96,17 @@ internal class UpdatesMenu(private val activity: Activity, private val ui: Handl
percent = 0
Thread({
val result = runCatching {
val file = SelfInstaller.download(activity, apk) { pct -> ui.post { percent = pct } }
val file = try {
SelfInstaller.download(activity, apk) { pct -> ui.post { percent = pct } }
} catch (e: java.io.IOException) {
// Each push replaces a test build's APK, so a list read before the push names a file that is gone.
if (r.pr <= 0) throw e
val fresh = runCatching { AppUpdates.refresh(activity) }.getOrNull() ?: throw e
ui.post { catalog = fresh }
val newer = fresh.tests.firstOrNull { it.tag == r.tag }?.apk?.takeIf { it.url != apk.url } ?: throw e
ui.post { percent = 0 }
SelfInstaller.download(activity, newer) { pct -> ui.post { percent = pct } }
}
ui.post { stage = activity.getString(R.string.upd_stage_installing); percent = -1 }
SelfInstaller.install(activity, file) { id -> session = id }
}