Skip to content
Latchkey

How to Distribute an Android App to Google Play in CI

supply uploads an AAB to a Play track using a Google service account JSON key with the Play Developer API enabled.

Create a service account in Google Play, grant it release permissions, and store its JSON key as a base64 secret. Decode it on the runner and pass the path to supply.

Steps

  • Create a Play service account and download its JSON key.
  • Save PLAY_SERVICE_ACCOUNT_B64 as a secret and decode it on the runner.
  • Run supply with the AAB path and a target track.

Fastfile

Fastfile
lane :play_internal do
  sh("echo \"$PLAY_SERVICE_ACCOUNT_B64\" | base64 -d > #{ENV['RUNNER_TEMP']}/play.json")
  upload_to_play_store(
    track: "internal",
    aab: "app/build/outputs/bundle/release/app-release.aab",
    json_key: "#{ENV['RUNNER_TEMP']}/play.json",
    release_status: "draft"
  )
end

Gotchas

  • The first ever release must be uploaded manually in the Play Console before the API can publish.
  • Delete the decoded play.json after upload so the service account key does not persist.

Related guides

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