Fetches the latest prerelease version from GitHub.
()
| 214 | |
| 215 | /// Fetches the latest prerelease version from GitHub. |
| 216 | pub fn fetch_latest_beta_version() -> Option<String> { |
| 217 | let agent = agent_with_timeout(FETCH_TIMEOUT); |
| 218 | let releases: Vec<GitHubRelease> = agent |
| 219 | .get(GITHUB_RELEASES_LIST_URL) |
| 220 | .header("User-Agent", "tracedecay") |
| 221 | .call() |
| 222 | .ok()? |
| 223 | .body_mut() |
| 224 | .read_json() |
| 225 | .ok()?; |
| 226 | // First prerelease that has the current platform's asset already |
| 227 | // uploaded. GitHub returns the list newest-first, so the first match |
| 228 | // is the latest installable beta. Releases whose CI is still in |
| 229 | // progress are skipped — they will be picked up on the next check. |
| 230 | releases |
| 231 | .into_iter() |
| 232 | .find(|r| r.prerelease && release_has_current_platform_asset(r)) |
| 233 | .map(|r| r.tag_name.trim_start_matches('v').to_string()) |
| 234 | } |
| 235 | |
| 236 | /// Returns true if the current build is a beta/prerelease version. |
| 237 | pub fn is_beta() -> bool { |
no test coverage detected