Build the Android app on our own Gitea runner
Pushing a v* tag builds the normal and FOSS APKs, signed with the upload key, and attaches them to a Gitea release; a manual run on a branch uploads a test build to the repo's packages. Everything runs on the Gitea server: a builder image with the Android SDK, an act_runner registered only for this repo, and plain shell steps (no third-party actions). The build itself is apps/mobile/scripts/build-android.sh, the same script for hand builds. Setup steps are in docs/ANDROID-CI.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# Build environment for the Android app, used by the Gitea Actions workflow
|
||||
# (.gitea/workflows/android.yml). Build it on the machine running the runner:
|
||||
#
|
||||
# docker build -t musicshare-android-builder deploy/android-builder
|
||||
#
|
||||
# Versions match what React Native 0.86 / Expo 57 ask for
|
||||
# (node_modules/react-native/gradle/libs.versions.toml). Gradle downloads anything
|
||||
# else it needs on first use; the workflow keeps ~/.gradle in a volume.
|
||||
FROM node:22-bookworm
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openjdk-17-jdk-headless unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \
|
||||
ANDROID_HOME=/opt/android-sdk \
|
||||
ANDROID_SDK_ROOT=/opt/android-sdk
|
||||
ENV PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
|
||||
|
||||
# Checksum from https://developer.android.com/studio#command-line-tools-only
|
||||
ARG CMDLINE_TOOLS=commandlinetools-linux-15859902_latest.zip
|
||||
ARG CMDLINE_TOOLS_SHA256=4e4c464f145a7512b57d088ac6c278c03c9eea610886b35a5e0804e74eedf583
|
||||
RUN curl -fsSLo /tmp/tools.zip https://dl.google.com/android/repository/$CMDLINE_TOOLS \
|
||||
&& echo "$CMDLINE_TOOLS_SHA256 /tmp/tools.zip" | sha256sum -c \
|
||||
&& mkdir -p $ANDROID_HOME/cmdline-tools \
|
||||
&& unzip -q /tmp/tools.zip -d $ANDROID_HOME/cmdline-tools \
|
||||
&& mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest \
|
||||
&& rm /tmp/tools.zip
|
||||
|
||||
RUN yes | sdkmanager --licenses > /dev/null \
|
||||
&& sdkmanager --install \
|
||||
"platform-tools" \
|
||||
"platforms;android-36" \
|
||||
"build-tools;36.0.0" \
|
||||
"ndk;27.1.12297006" \
|
||||
"cmake;3.22.1" > /dev/null \
|
||||
&& chmod -R a+rwX $ANDROID_HOME
|
||||
@@ -0,0 +1,19 @@
|
||||
# Gitea Actions runner for building the Android app (.gitea/workflows/android.yml).
|
||||
# Runs on the Gitea server; see docs/ANDROID-CI.md for setup.
|
||||
#
|
||||
# It starts build containers through the host's Docker, so it has the same power as
|
||||
# root on this machine: only register it for the musicshare repository.
|
||||
services:
|
||||
runner:
|
||||
image: gitea/act_runner:0.6.1
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
GITEA_INSTANCE_URL: https://gitea.chrisedwards.tech
|
||||
# From the repo: Settings > Actions > Runners > Create new runner. Only needed the first time.
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN: ${RUNNER_TOKEN:-}
|
||||
GITEA_RUNNER_NAME: musicshare-android
|
||||
CONFIG_FILE: /config.yaml
|
||||
volumes:
|
||||
- ./config.yaml:/config.yaml:ro
|
||||
- ./data:/data
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
@@ -0,0 +1,23 @@
|
||||
# act_runner settings (full reference: `docker run --rm gitea/act_runner:0.6.1 act_runner generate-config`).
|
||||
log:
|
||||
level: info
|
||||
|
||||
runner:
|
||||
file: /data/.runner
|
||||
# One build at a time: an Android build wants several GB of memory.
|
||||
capacity: 1
|
||||
timeout: 3h
|
||||
labels:
|
||||
- "musicshare-android:docker://musicshare-android-builder"
|
||||
|
||||
cache:
|
||||
enabled: false
|
||||
|
||||
container:
|
||||
# Use the locally built deploy/android-builder image rather than pulling from a registry.
|
||||
force_pull: false
|
||||
privileged: false
|
||||
# The volumes the workflow may mount (Gradle and npm caches), and nothing else.
|
||||
valid_volumes:
|
||||
- musicshare-gradle
|
||||
- musicshare-npm
|
||||
Reference in New Issue
Block a user