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_B64as a secret and decode it on the runner. - Run
supplywith the AAB path and a targettrack.
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"
)
endGotchas
- The first ever release must be uploaded manually in the Play Console before the API can publish.
- Delete the decoded
play.jsonafter upload so the service account key does not persist.
Related guides
How to Sign an Android App in CI With a KeystoreSign an Android release in CI by decoding a base64 keystore from a secret into a temp file, passing store and…
How to Manage Mobile Signing Secrets Safely in CIManage mobile signing secrets safely in CI by base64-encoding keys into repo or environment secrets, decoding…