Release the Qt launcher from the fileapi forge

.forge/jobs.toml follows GitHub's main and, on each commit, builds the Qt
APK on Depot (ci/forge-apk.sh: Qt 6.8.3 via aqt, SDK/NDK 26.1, the
committed key) and publishes it as a forge release build-<versionCode>,
drafted until the APK and version.json are both up. versionCode is minutes
since the epoch, above every GitHub run number. The in-app updater now
reads releases/latest on the forge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiQsCq11CwCPnKPp9D
This commit is contained in:
Claude committed 2026-11-06 08:14:21 +00:00
1 parent 35b4c44168
commit f69cb74ce7
4 files changed
+79 -4

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
# fileapi forge CI (https://fileapi.fastapicloud.dev/forge/nandi.uk/launcher).
# The forge follows GitHub's main (below), so a commit to either one builds the Qt APK on
# Depot and publishes it as a release here, which the phone's updater reads
# (releases/latest/assets/version.json). Needs DEPOT_TOKEN and DEPOT_PROJECT_ID (user secrets).
[upstream]
url = "https://github.com/codegod100/launcher.git"
branches = ["main"]
interval = 60
[[job]]
name = "apk"
branches = ["main"]
timeout = 3600
image = "eclipse-temurin:17-jdk-noble"
run = "bash ci/forge-apk.sh"
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# Builds the Qt launcher APK (qt/) and publishes it as a forge release: build-<versionCode>,
# holding ultra-launcher.apk and version.json, made a draft first and published once both
# files are up, so releases/latest never lacks them. Runs in .forge/jobs.toml's "apk" job.
set -euo pipefail
cd /src
QT_VERSION=6.8.3
NDK=26.1.10909125
# Minutes since the epoch: always above the GitHub builds' run numbers and always rising.
VERSION_CODE=$(( $(date +%s) / 60 ))
echo "== tools"
apt-get update -qq
apt-get install -y -qq --no-install-recommends python3-pip python3-venv ninja-build cmake unzip curl ca-certificates >/dev/null
python3 -m venv /opt/aqt && /opt/aqt/bin/pip install -q aqtinstall
echo "== Qt $QT_VERSION (android arm64 + host)"
/opt/aqt/bin/aqt install-qt linux android "$QT_VERSION" android_arm64_v8a -O /opt/Qt --autodesktop >/dev/null
QT_ROOT=/opt/Qt/$QT_VERSION/android_arm64_v8a
QT_HOST=/opt/Qt/$QT_VERSION/gcc_64
echo "== Android SDK + NDK $NDK"
export ANDROID_SDK_ROOT=/opt/android-sdk
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
curl -fsSL -o /tmp/cmdline.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q /tmp/cmdline.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && mv "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest"
yes | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null || true
"$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --install "platform-tools" "ndk;$NDK" "platforms;android-35" "build-tools;35.0.0" >/dev/null
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$NDK
echo "== build (versionCode $VERSION_CODE)"
# Signed with the committed key, like every earlier build, so it installs over them.
export QT_ANDROID_KEYSTORE_PATH=/src/android/app/debug.keystore
export QT_ANDROID_KEYSTORE_ALIAS=androiddebugkey
export QT_ANDROID_KEYSTORE_STORE_PASS=android
export QT_ANDROID_KEYSTORE_KEY_PASS=android
"$QT_ROOT/bin/qt-cmake" -S qt -B build-android -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DANDROID_SDK_ROOT="$ANDROID_SDK_ROOT" -DANDROID_NDK_ROOT="$ANDROID_NDK_ROOT" \
-DQT_HOST_PATH="$QT_HOST" -DQT_ANDROID_SIGN_APK=ON -DVERSION_CODE="$VERSION_CODE"
cmake --build build-android --target apk
apk=$(find build-android -name "*-signed.apk" | head -1)
test -n "$apk" || { find build-android -name "*.apk"; exit 1; }
cp "$apk" ultra-launcher.apk
printf '{"versionCode": %s, "commit": "%s"}\n' "$VERSION_CODE" "${FORGE_SHA:-}" > version.json
echo "== release build-$VERSION_CODE"
api="${FORGE_URL:-https://fileapi.fastapicloud.dev}"
api="${api%/}/api/forge/repos/${FORGE_REPO:-nandi.uk/launcher}/releases"
echo "env: FORGE_REPO=${FORGE_REPO:-} FORGE_URL=${FORGE_URL:-} FORGE_API=${FORGE_API:-}"
auth=(-H "Authorization: Bearer $FORGE_TOKEN")
tag="build-$VERSION_CODE"
curl -fsS "${auth[@]}" -H "Content-Type: application/json" -X POST "$api" \
-d "{\"tag\": \"$tag\", \"name\": \"ultra Home build $VERSION_CODE\", \"ref\": \"${FORGE_SHA:-}\", \"draft\": true, \"notes\": \"Qt launcher built from ${FORGE_SHA:-?}.\"}" >/dev/null
curl -fsS "${auth[@]}" -T ultra-launcher.apk "$api/$tag/assets/ultra-launcher.apk" >/dev/null
curl -fsS "${auth[@]}" -T version.json "$api/$tag/assets/version.json" >/dev/null
curl -fsS "${auth[@]}" -H "Content-Type: application/json" -X PATCH "$api/$tag" -d '{"draft": false}' >/dev/null
echo "published $tag"
@@ -74,7 +74,6 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class HomeActivity extends QtActivity { public class HomeActivity extends QtActivity {
/** The GitHub release the updater installs from. */ /** The GitHub release the updater installs from. */
static final String RELEASE = "launcher-qt-latest";
// The WebView build's host id: its widgets are bound to it, so they carry over. // The WebView build's host id: its widgets are bound to it, so they carry over.
static final int HOST_ID = 0x0171; static final int HOST_ID = 0x0171;
static final int REQ_BIND = 1, REQ_CONFIGURE = 2; static final int REQ_BIND = 1, REQ_CONFIGURE = 2;
@@ -26,9 +26,10 @@ import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
/** /**
* Updates the launcher from the rolling "launcher-latest" GitHub prerelease. CI uploads * Updates the launcher from the newest release on V's fileapi forge (nandi.uk/launcher),
* which .forge/jobs.toml builds on every commit to main. Each release holds
* version.json ({"versionCode": N, "commit": SHA}) next to ultra-launcher.apk, with N the * version.json ({"versionCode": N, "commit": SHA}) next to ultra-launcher.apk, with N the
* workflow run number, which is also the APK's versionCode. When N is newer than the installed * APK's versionCode. When N is newer than the installed
* build, the APK is streamed into a PackageInstaller session and committed. Android then asks * build, the APK is streamed into a PackageInstaller session and committed. Android then asks
* the user to confirm (or, on Android 12+ once this app installed itself, may not ask at all). * the user to confirm (or, on Android 12+ once this app installed itself, may not ask at all).
* *
@@ -36,7 +37,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
* "Check for updates" checks now and reports what it found. * "Check for updates" checks now and reports what it found.
*/ */
final class Updater { final class Updater {
static final String BASE = "https://github.com/codegod100/launcher/releases/download/" + HomeActivity.RELEASE + "/"; static final String BASE =
"https://fileapi.fastapicloud.dev/api/forge/repos/nandi.uk/launcher/releases/latest/assets/";
static final long CHECK_EVERY = 6 * 60 * 60 * 1000L; static final long CHECK_EVERY = 6 * 60 * 60 * 1000L;
static final String EXTRA_VERSION = "dev.ultra.launcher.VERSION"; static final String EXTRA_VERSION = "dev.ultra.launcher.VERSION";