Skip to Content
DeploymentAndroid CI

Android CI

.github/workflows/build-android.yml - builds both APK variants and cuts a GitHub Release on every push to main.

Triggers

on: push: branches: [ "main" ] pull_request: branches: [ "main" ] workflow_dispatch:
  • push to main → build + release
  • PR to main → build only (the release step is if: github.event_name != 'pull_request')
  • manualworkflow_dispatch

Runner

jobs: build: runs-on: self-hosted permissions: contents: write env: ANDROID_HOME: /home/karmakar/Android/Sdk ANDROID_SDK_ROOT: /home/karmakar/Android/Sdk

It runs on a self-hosted runner with the Android SDK already installed - faster than a cold GitHub-hosted runner downloading the SDK each time, and the build machine is the same one that hosts the signaling server.

Steps

The build step

./gradlew assembleDebug assembleRelease --stacktrace

Both variants in one invocation:

VariantOutputShrinking
assembleDebugViora-v1.8.9-b89-debug.apknone, debuggable
assembleReleaseViora-v1.8.9-b89-release.apkR8 minify + obfuscation + resource shrink, debug-signed

Release is debug-signed on purpose - this isn’t a Play Store artifact, it’s a smaller, obfuscated build for direct install. See R8 & minification.

Locate & rename

The APK basename comes from base { archivesName } in build.gradle.kts (Viora-v${versionName}-b${versionCode}). The step strips the -debug suffix to get the base name and copies mapping/release/mapping.txt to ${BASE_NAME}-mapping.txt.

Release

softprops/action-gh-release@v2 creates a release tagged {base_name}-r{github.run_number} (e.g. Viora-v1.8.9-b89-r42) with three attachments:

FilePurpose
…-debug.apkDebuggable, no shrinking
…-release.apkR8 minify + obfuscation + resource shrinking
…-mapping.txtR8 mapping - keep this to de-obfuscate release crash traces

Version bumps

Bump appVersionName / appVersionCode in android/app/build.gradle.kts. That drives versionName / versionCode, the archivesName, and therefore the release tag and asset names.

If you don’t have a self-hosted runner

Change runs-on: self-hosted to runs-on: ubuntu-latest and add an android-actions/setup-android@v3 step before the build. The self-hosted ANDROID_HOME env values then need removing (or overriding) since the hosted action sets its own.