GitHub actions is really amazing because you can literally build your apps with just a push of your code to GitHub. I’ve been playing with GitHub actions lately and I really really love it. I’ve used GitHub actions before to build Python packages and Electron apps and I thought that why not for Android as well.
Before getting started, complete the following steps:
- Encode your KeyStore file (.jks) to base64.
openssl base64 -A -in keystore.jks -out base64.txt
- Copy the content of base64.txt and store it as SIGNINGKEYBASE64 in GitHub secrets.
- Store your alias as ALIAS in GitHub secrets.
- Store your keystore password as KEYSTOREPASSWORD and key password as KEYPASSWORD in GitHub secrets.
Now in your project create a folder “.github” and inside this folder create a folder “workflows”. Inside workflows folder create a file “build.yml” and add the below content in build.yml.
You are now good to go. So anytime you create a tag and push the tag to GitHub, the actions is going to build apk and aab files, sign them, make artifacts, create a release with the tag, upload the files in the release as assets.
Here’s an example project of the above usage:
Want to use GitHub secrets in your Android Apps? Check out this post.