Android CI/CD part 2: Building and pushing to Play Store in GitHub Actions
In the previous post of this series, we showed how to use Fastlane to create an automated way to build, package, and upload your Android app to Play Console’s Internal test channel locally. In this post, we will show how to use that same script but running it on GitHub Actions to create a CI/CD system that gets triggered when you push to a specific branch.
As noted in the previous post, we aim to make this automated way as CI/CD-agnostic as possible. Therefore, even if you are not using GitHub Actions, I believe that this will be easy to adapt to the platform of your choice.
Set the variables
In the last post, we created a script that sets the necessary environment variables and then runs the fastlane deploy
command. So the first thing here is to set the environment variables in the GitHub Actions runner.
In your GitHub project, head to the Settings
tab -> Secrets and variables
-> Actions
. Note that the secrets that you are setting will not be readable once you set them. You would be able to update their value, but not see the existing value. So make sure that you store the values of these secrets safely somewhere else. From there you would need to set these secrets:
GPLAY_SERVICE_ACCOUNT_KEY
*STAGING_KEYSTORE_FILE
*STAGING_KEYSTORE_PASSWORD
STAGING_KEY_ALIAS
STAGING_KEY_PASSWORD
STAGING_PACKAGE_NAME
The 2 variables with the asterisk are not string values, but files that need to be stored here somehow. We will use Base64 encoding to store these files as strings.