DEV Community

Cover image for Building, Signing and Releasing Android Apps with GitHub Actions
Sumanth Perambuduri
Sumanth Perambuduri

Posted on • Edited on

Building, Signing and Releasing Android Apps with GitHub Actions

GitHub Actions is honestly amazing — you can automate your entire build process just by pushing code to GitHub! Recently, I’ve been experimenting with it and absolutely love how powerful and flexible it is. I’ve used GitHub Actions before to build Python packages and Electron apps, and then I thought — why not try it for Android too?

Before getting started
Make sure you’ve completed the following setup steps:

  1. Encode your KeyStore file (.jks) to Base64:

    openssl base64 -A -in keystore.jks -out base64.txt
    
  2. Copy the contents of base64.txt and add it as a GitHub secret named SIGNINGKEYBASE64.

  3. Add the following secrets as well:

  • ALIAS → your key alias
  • KEYSTOREPASSWORD → your keystore password
  • KEYPASSWORD → your key password

Setting Up the Workflow File
Now, in your project root, create the following folder structure:

.github/
└── workflows/
    └── build.yml
Enter fullscreen mode Exit fullscreen mode

Inside the workflows folder, create a file named build.yml and add the following content to it:

You’re All Set! 🚀
That’s it — you’re now good to go!
Whenever you create a tag (for example, v1.2.3), make a commit with the same message (v1.2.3), and push it to GitHub — GitHub Actions will automatically:

  • Build the APK and AAB files
  • Sign them with your keystore credentials
  • Create a release using the tag
  • And upload the files as release assets

Version bumping, committing, tagging, and pushing can be done effortlessly using a handy tool called Bumper.

It automates version management, so you can focus on building instead of manually updating version numbers every time.

Example Project
If you’d like to see this entire build process in action, check out my example project:
👉 Spotify Playlist Downloader

Want to use GitHub secrets in your Android Apps? Check out this post.

Top comments (4)

Collapse
 
vitalykarasik profile image
Vitaly Karasik

Hi, many thanks!
Regarding 'signingKeyBase64' - is the key and keystore the same thing (format)?
I already have my android keystore into Github secrets and it works nice for signing 3D Unity apps, but when I tried to use it in r0adkll/sign-android-release@v1, I received "Failed to load signer "signer #1"
java.io.EOFException" exception.

Collapse
 
supersuman profile image
Sumanth Perambuduri

Hey @vitalykarasik , I've found out the solution in issues.
Check out this link for the solution.

Collapse
 
alinavaie profile image
Ali Navaie

Hi
I did exactly same but I got this error:

Execution failed for task ':app:validateSigningRelease'.

Keystore file '/home/runner/work/SampleApp/SampleApp/android/app/my-upload-key.keystore' not found for signing config 'release'

I know 'my-upload-key.keystore' is not uploaded to my repository, but the questions is why it needs this file while I've already import the key base64 content in the action secret?

Collapse
 
alinavaie profile image
Ali Navaie