ci: build the release APK on the MacBook runner
All checks were successful
Build & Release APK / build (push) Successful in 10m50s

The desktop runner is offline and the old VPS runner was retired, so
nothing could run this workflow. Run it in host mode on the macos
runner instead: no container, using the runner's Node, JDK 21 and
Android SDK. Keystore and release JSON now live in the job workspace
instead of /tmp.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
marcus
2026-11-24 22:46:42 -08:00
parent 694e180855
commit be0f893f67

View File

@@ -6,54 +6,31 @@ on:
jobs: jobs:
build: build:
# RN/NDK builds need ~6GB and once took down the 8GB VPS — desktop runner only. # Builds on Marcus's MacBook: runner label `macos`, host mode (no container),
# Jobs queue while the desktop is offline. # using the Node, JDK 21 and Android SDK set in the runner's config.yaml.
runs-on: desktop # Jobs queue while the laptop is asleep or offline.
container: # (Was `desktop` + a Linux container until 2026-11-24.)
image: eclipse-temurin:21-jdk runs-on: macos
steps: steps:
# actions/checkout needs node, which this container lacks — clone directly
- name: Checkout - name: Checkout
run: | run: |
apt-get update -qq && apt-get install -y -qq git unzip curl xz-utils >/dev/null
git init -q . git init -q .
git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}" git fetch -q --depth 1 "https://git.rehbock.xyz/${{ github.repository }}.git" "${{ github.sha }}"
git checkout -q FETCH_HEAD git checkout -q FETCH_HEAD
# /root/.npm and /root/.gradle and /root/android-sdk are persistent named - name: Toolchain
# volumes (act_runner config.yaml) — downloads below only happen on a cold cache.
- name: Install Node 22 (cached in npm volume)
run: | run: |
NODE_DIR="$HOME/.npm/_node-v22.14.0" node --version
if [ ! -x "$NODE_DIR/bin/node" ]; then java -version 2>&1 | head -1
curl -sLo /tmp/node.tar.xz https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-x64.tar.xz test -d "$ANDROID_HOME/platforms" && echo "Android SDK: $ANDROID_HOME"
mkdir -p "$NODE_DIR" && tar xJf /tmp/node.tar.xz -C "$NODE_DIR" --strip-components=1
fi
echo "$NODE_DIR/bin" >> "$GITHUB_PATH"
"$NODE_DIR/bin/node" --version
- name: npm ci - name: npm ci
run: npm ci --no-audit --no-fund run: npm ci --no-audit --no-fund
- name: Install Android SDK + NDK (cached volume)
run: |
SDK="$HOME/android-sdk"
SDKMAN="$SDK/cmdline-tools/latest/bin/sdkmanager"
if [ ! -x "$SDKMAN" ]; then
mkdir -p "$SDK/cmdline-tools"
curl -sLo /tmp/ct.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q /tmp/ct.zip -d /tmp
mv /tmp/cmdline-tools "$SDK/cmdline-tools/latest"
fi
yes | "$SDKMAN" --sdk_root="$SDK" --licenses >/dev/null 2>&1 || true
"$SDKMAN" --sdk_root="$SDK" \
"platform-tools" "platforms;android-36" "build-tools;36.0.0" \
"ndk;27.1.12297006" "cmake;3.22.1" >/dev/null
- name: Decode signing keystore - name: Decode signing keystore
env: env:
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }} KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
run: echo "$KEYSTORE_B64" | base64 -d > /tmp/release.jks run: echo "$KEYSTORE_B64" | base64 -d > "$PWD/.release.jks"
- name: Prebuild android project - name: Prebuild android project
env: env:
@@ -63,13 +40,12 @@ jobs:
- name: Build signed release APK (arm64) - name: Build signed release APK (arm64)
env: env:
HEALTH_KEYSTORE: /tmp/release.jks
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: health KEY_ALIAS: health
VERSION_CODE: ${{ github.run_number }} VERSION_CODE: ${{ github.run_number }}
VERSION_NAME: 1.0.${{ github.run_number }} VERSION_NAME: 1.0.${{ github.run_number }}
run: | run: |
export ANDROID_HOME="$HOME/android-sdk" export HEALTH_KEYSTORE="$PWD/.release.jks"
echo "sdk.dir=$ANDROID_HOME" > android/local.properties echo "sdk.dir=$ANDROID_HOME" > android/local.properties
cd android && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a \ cd android && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a \
--no-daemon --console=plain --no-daemon --console=plain
@@ -85,8 +61,8 @@ jobs:
curl -sf -X POST "$API/releases" \ curl -sf -X POST "$API/releases" \
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Automated build of commit ${{ github.sha }}\",\"target_commitish\":\"${{ github.sha }}\"}" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Automated build of commit ${{ github.sha }}\",\"target_commitish\":\"${{ github.sha }}\"}" \
> /tmp/release.json > "$PWD/.release.json"
RID=$(grep -o '"id":[0-9]*' /tmp/release.json | head -1 | cut -d: -f2) RID=$(grep -o '"id":[0-9]*' "$PWD/.release.json" | head -1 | cut -d: -f2)
echo "release id: $RID" echo "release id: $RID"
curl -sf -X POST "$API/releases/$RID/assets?name=health-app-$TAG-arm64.apk" \ curl -sf -X POST "$API/releases/$RID/assets?name=health-app-$TAG-arm64.apk" \
-H "Authorization: token $TOKEN" \ -H "Authorization: token $TOKEN" \