From f69cb74ce78e09c87a9b853fde6ff20066bbe36a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 08:14:21 +0000 Subject: [PATCH] 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-, 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 Claude-Session: https://claude.ai/code/session_01DPL5hiQsCq11CwCPnKPp9D --- .forge/jobs.toml | 16 +++++ ci/forge-apk.sh | 58 +++++++++++++++++++ .../src/dev/ultra/launcher/HomeActivity.java | 1 - .../src/dev/ultra/launcher/Updater.java | 8 ++- 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 .forge/jobs.toml create mode 100755 ci/forge-apk.sh diff --git a/.forge/jobs.toml b/.forge/jobs.toml new file mode 100644 index 0000000..1f3225c --- /dev/null +++ b/.forge/jobs.toml @@ -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" diff --git a/ci/forge-apk.sh b/ci/forge-apk.sh new file mode 100755 index 0000000..7e23f3e --- /dev/null +++ b/ci/forge-apk.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Builds the Qt launcher APK (qt/) and publishes it as a forge release: build-, +# 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" diff --git a/qt/android/src/dev/ultra/launcher/HomeActivity.java b/qt/android/src/dev/ultra/launcher/HomeActivity.java index 5178869..ea74c13 100644 --- a/qt/android/src/dev/ultra/launcher/HomeActivity.java +++ b/qt/android/src/dev/ultra/launcher/HomeActivity.java @@ -74,7 +74,6 @@ import java.util.concurrent.ConcurrentHashMap; */ public class HomeActivity extends QtActivity { /** 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. static final int HOST_ID = 0x0171; static final int REQ_BIND = 1, REQ_CONFIGURE = 2; diff --git a/qt/android/src/dev/ultra/launcher/Updater.java b/qt/android/src/dev/ultra/launcher/Updater.java index 984da3f..971c633 100644 --- a/qt/android/src/dev/ultra/launcher/Updater.java +++ b/qt/android/src/dev/ultra/launcher/Updater.java @@ -26,9 +26,10 @@ import java.nio.charset.StandardCharsets; 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 - * 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 * 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. */ 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 String EXTRA_VERSION = "dev.ultra.launcher.VERSION";