CI: build the APK in the cluster's android-sdk image
apk job uses git.site.latha.org/cluster-services/android-sdk:latest; gitea-apk.sh uses the image's JDK/SDK when present and falls back to installing them (documented, for use with node:22-bookworm until the image is built). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
67b6b58c94
commit
a8ce535f37
3 files changed
+30
-16
No files matched your search
+24
-14
@@ -13,23 +13,33 @@ export VERSION_CODE=$(( $(date +%s) / 60 ))
|
||||
COMMIT="${GITHUB_SHA:-$(git rev-parse HEAD)}"
|
||||
|
||||
echo "== tools"
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends openjdk-17-jdk-headless unzip zip curl ca-certificates git >/dev/null
|
||||
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
|
||||
# In the cluster's android-sdk image the JDK, SDK and common tools are already there; on a bare
|
||||
# image (the documented fallback, e.g. node:22-bookworm) they are installed below.
|
||||
if ! command -v javac >/dev/null || ! command -v zip >/dev/null || ! command -v curl >/dev/null; then
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq --no-install-recommends openjdk-17-jdk-headless unzip zip curl ca-certificates git >/dev/null
|
||||
fi
|
||||
command -v moon >/dev/null || [ -x "$HOME/.moon/bin/moon" ] || curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
|
||||
export PATH="$HOME/.moon/bin:$PATH"
|
||||
moon update
|
||||
|
||||
echo "== Android SDK (build-tools and the platform jar only)"
|
||||
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 "build-tools;35.0.0" >/dev/null
|
||||
# Only android.jar is needed from the platform: unzipping the whole thing (sdkmanager) is slow.
|
||||
curl -fsSL -o /tmp/platform.zip https://dl.google.com/android/repository/platform-35_r02.zip
|
||||
mkdir -p "$ANDROID_SDK_ROOT/platforms" && unzip -q /tmp/platform.zip 'android-35/android.jar' -d "$ANDROID_SDK_ROOT/platforms"
|
||||
SDK="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/opt/android-sdk}}"
|
||||
if [ -f "$SDK/platforms/android-35/android.jar" ] && ls -d "$SDK"/build-tools/35* >/dev/null 2>&1; then
|
||||
echo "== Android SDK from the image ($SDK)"
|
||||
else
|
||||
echo "== Android SDK fallback (build-tools and the platform jar only)"
|
||||
SDK=/opt/android-sdk
|
||||
mkdir -p "$SDK/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 "$SDK/cmdline-tools"
|
||||
mv "$SDK/cmdline-tools/cmdline-tools" "$SDK/cmdline-tools/latest"
|
||||
yes | "$SDK/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null || true
|
||||
"$SDK/cmdline-tools/latest/bin/sdkmanager" --install "build-tools;35.0.0" >/dev/null
|
||||
# Only android.jar is needed from the platform: unzipping the whole thing (sdkmanager) is slow.
|
||||
curl -fsSL -o /tmp/platform.zip https://dl.google.com/android/repository/platform-35_r02.zip
|
||||
mkdir -p "$SDK/platforms" && unzip -q /tmp/platform.zip 'android-35/android.jar' -d "$SDK/platforms"
|
||||
fi
|
||||
export ANDROID_SDK_ROOT="$SDK"
|
||||
|
||||
echo "== build (versionCode $VERSION_CODE)"
|
||||
android/build.sh ultra-launcher.apk
|
||||
|
||||
Reference in new issue
Block a user