TypeScript
fix(mobile): publish each Android beta only once
Julius Marminge2577baf8b0dc
diff --git a/.github/scripts/mirror-play-apk.cjs b/.github/scripts/mirror-play-apk.cjsindex 51991c34643..90b368b2aa0 100644--- a/.github/scripts/mirror-play-apk.cjs+++ b/.github/scripts/mirror-play-apk.cjs@@ -164,25 +164,15 @@ async function main() {}const safeName = build.versionName.replace(/[^0-9A-Za-z.]+/g, "-").replace(/^-|-$/g, "");const apkName = `t3code-android-${channel}-${safeName}-${build.versionCode}.apk`;- const tag = outputDirectory ? undefined : requireEnv("RELEASE_TAG");- const snapshotTag = `android-beta-${build.versionCode}`;- const release = tag ? readRelease(tag) : undefined;- const snapshot = tag ? readRelease(snapshotTag) : undefined;- const hasApk = (value) =>- value &&- !value.isDraft &&- value.assets.some(+ const tag = `android-beta-${build.versionCode}`;+ const release = outputDirectory ? undefined : readRelease(tag);+ if (+ release &&+ !release.isDraft &&+ release.assets.some((asset) => asset.name === apkName && asset.state === "uploaded" && asset.size > 0,- );- const pruneBetaAssets = () => {- for (const stale of release?.assets ?? []) {- if (stale.name.endsWith(".apk") && stale.name !== apkName) {- gh("release", "delete-asset", tag, stale.name, "--yes");- }- }- };- if (hasApk(release) && hasApk(snapshot)) {- pruneBetaAssets();+ )+ ) {console.log(`${apkName} is already published.`);return;}@@ -209,16 +199,8 @@ async function main() {"","These builds have been promoted for wider testing, but may still contain bugs. The beta is optional; the store app also works with Nightly servers.",].join("\n");- // Publish the versioned beta first, then advance the stable download page.// The build number makes retries and unchanged hourly checks idempotent.- publishBeta(- snapshotTag,- apkPath,- notes,- `Android beta ${build.versionName} (${build.versionCode})`,- );- publishBeta(tag, apkPath, notes, "T3 Code for Android (beta)");- pruneBetaAssets();+ publishBeta(tag, apkPath, notes, `Android beta ${build.versionName} (${build.versionCode})`);} finally {fs.rmSync(path.dirname(apkPath), { recursive: true, force: true });}diff --git a/.github/workflows/mobile-android-apk.yml b/.github/workflows/mobile-android-apk.ymlindex db23758b2bf..c3db7142e67 100644--- a/.github/workflows/mobile-android-apk.yml+++ b/.github/workflows/mobile-android-apk.yml@@ -1,7 +1,7 @@name: Mobile Android APK-# Checks closed testing hourly. New beta builds get a versioned prerelease and-# update the android-beta download page. Unchanged checks publish nothing.+# Checks closed testing hourly. Each new beta gets one versioned prerelease.+# Unchanged checks publish nothing.on:schedule:# Avoid minute zero, when GitHub scheduled jobs are busiest.@@ -21,7 +21,6 @@ jobs:contents: writeenv:PACKAGE_NAME: com.t3tools.t3code- RELEASE_TAG: android-betasteps:- id: credentialsname: Check for Play credentialsdiff --git a/docs/operations/release.md b/docs/operations/release.mdindex 87622f1d9be..c96551bc00c 100644--- a/docs/operations/release.md+++ b/docs/operations/release.md@@ -321,9 +321,9 @@ unreleased major and get its first beta build approved.## Android APK mirror`.github/workflows/mobile-android-apk.yml` checks the Google Play Alpha closed-testing-track hourly. A new beta gets an `android-beta-<build-number>` prerelease and updates-the `android-beta` download page. Both contain only the beta APK. Unchanged checks-publish nothing, and interrupted draft uploads resume on the next check.+track hourly. Each new beta gets one `android-beta-<build-number>` prerelease+containing its APK. Unchanged checks publish nothing, and interrupted draft+uploads resume on the next check.Normal Nightly releases include the newest processed internal-testing APK availablewhen the release publishes. Internal builds do not create separate Android releases.diff --git a/docs/user/install.md b/docs/user/install.mdindex 2625b133b2f..9f3871f2a25 100644--- a/docs/user/install.md+++ b/docs/user/install.md@@ -118,7 +118,7 @@ The store apps work with both stable and Nightly servers. Test builds are option- **iPhone and iPad:** TestFlight is invite-only.- **Android:** download an APK from the- [Android beta release](https://github.com/pingdotgg/t3code/releases/tag/android-beta).+ [Android beta releases](https://github.com/pingdotgg/t3code/releases?q=android-beta-).If the app crashes during launch, open Settings → Diagnostics on the next launchthat succeeds. It lists startup crashes from the last 7 days with the error and