Skip to content
Latchkey

How to Distribute a Build With Firebase App Distribution in CI

Firebase App Distribution ships pre-release builds to named tester groups from CI using a Google service account credential.

Authenticate the Firebase CLI with GOOGLE_APPLICATION_CREDENTIALS pointing at a decoded service account key, then run appdistribution:distribute with the app ID and tester groups.

Steps

  • Store the service account JSON as a base64 secret and decode it on the runner.
  • Set GOOGLE_APPLICATION_CREDENTIALS to the decoded file path.
  • Run firebase appdistribution:distribute with the app ID and groups.

Terminal

Terminal
echo "$FIREBASE_SA_B64" | base64 -d > "$RUNNER_TEMP/firebase-sa.json"
export GOOGLE_APPLICATION_CREDENTIALS="$RUNNER_TEMP/firebase-sa.json"
firebase appdistribution:distribute app/build/outputs/apk/release/app-release.apk \
  --app "1:1234567890:android:abcdef" \
  --groups "qa,beta-testers" \
  --release-notes "CI build $GITHUB_SHA"

Gotchas

  • The service account needs the Firebase App Distribution Admin role to publish releases.
  • Remove the decoded credential file after distribution completes.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →