How To Build, Sign And Publish Android Application Using Github Actions
<p>The main goal of this article is to provide a complete implementation of a <strong>Github Workflow</strong> capable of securely building, signing, and publishing Android apps.</p>
<p>Follow these steps to create the <strong>Github Workflow</strong>:</p>
<p>1. Generate a <strong>new signing keystore</strong></p>
<p>2. Add the following secrets to your Github repository (you’ll need to convert <strong>keystore.jks</strong> to <strong>base64</strong> string)</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:770/1*SGD7WaFT-VH9cZVUi9OYOw.png" style="height:298px; width:700px" /></p>
<p>In Repository Settings Add The Following Secrets To <strong>Security -> Secrets and variables -> Actions -> Repository secrets</strong></p>
<p>3. Add a new signing configuration to your app’s <strong>build.gradle</strong> file. Note that <strong>rootProject.name</strong> is defined in the <strong>settings.gradle </strong>file.</p>
<pre>
android {
// ...
defaultConfig {
// ...
versionName "1.1"
// ...
}
signingConfigs {
release {
storeFile = file("keystore/android_keystore.jks")
storePassword System.getenv("SIGNING_STORE_PASSWORD")
keyAlias System.getenv("SIGNING_KEY_ALIAS")
keyPassword System.getenv("SIGNING_KEY_PASSWORD")
}
}
buildTypes {
// ...
release {
// ...
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "${rootProject.name}_${versionName}.apk"
}
}
signingConfig signingConfigs.release
}
}
}</pre>
<p>4. Add <strong>Github Workflow</strong> to your repository in the <strong>.github/workflows</strong> folder. Here <strong><<application name>></strong> and <strong><<project name>></strong> are placeholders for <strong>rootProject.name</strong> and your Github repository’s name respectively.</p>
<p><a href="https://medium.com/geekculture/how-to-build-sign-and-publish-android-application-using-github-actions-aa6346679254">Click Here</a></p>