Android CI/CD part 1: Locally building and pushing to Play Store using Fastlane

Bevan Steele
Rock and Null
Published in
2 min readMar 19, 2023
Photo by Ben Garratt / Unsplash

Automating the deployment of Android apps to Google Play, I believe is a must for teams with more than 1–2 people. Having the latest test version on your physical device, allows you to perform more thorough testing and allows non-engineer members of the team to play with the app and maybe even contribute to QA.

Even though Play Console is elegant and intuitive, having to manually do these test releases is arduous and a waste of time. The good news is that Play Console provides an API to perform almost all the publishing actions. The bad news is that it takes some time to set it up and requires many steps.

In this 2 posts series, I aim to give the simplest way possible to set up a CI/CD system for Android apps using GitHub Actions. The result would be to push to a specific branch (e.g. called staging) and the Android app will be deployed to Play Console's internal testing channel. If you add and properly opt-in testers in that channel, then they will get an available update for the specific app within a few minutes (for an overview of Play Console's distribution capabilities, check this post).

In general, most CI/CD platforms such as GitHub Actions do not offer running them locally. This makes it hard to debug while setting up the system. Therefore, my preference is to create pipelines that are as CI/CD-agnostic as possible. In this case, I will be using Fastlane which is a tool for automating many app-specific workflows, for iOS & Android, including pushing to the Play Console Internal channel. Once we set this up, and test it locally, we will just run this in the GitHub Action runner in the next post.

Set up access to the Google Play Developer API

The first step in this journey is to get access to the API that allows you to make publishing actions in the Google Play Console. The steps to set this up are listed here. What you want to end up with, is a JSON file that has the credentials for a service account that has access to your developer account. Since these steps are confusing at first, I am listing here an overview of what needs to be done (at the time of writing):

Continue reading this post in our official blog…

--

--