feat: Implement Android keystore setup for secure signing in release builds and update documentation for local and CI/CD environments

This commit is contained in:
Achintha Isuru
2026-02-28 22:32:54 -05:00
parent 7c701ded5f
commit 1ab5ba2e6f
14 changed files with 190 additions and 60 deletions

View File

@@ -7,8 +7,7 @@ gradle-wrapper.jar
GeneratedPluginRegistrant.java
.cxx/
# Remember to never publicly share your keystore.
# Remember to never publicly share your keystore files.
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks

View File

@@ -1,4 +1,5 @@
import java.util.Base64
import java.util.Properties
plugins {
id("com.android.application")
@@ -20,6 +21,13 @@ dartDefinesString.split(",").forEach {
}
}
val keystoreProperties = Properties().apply {
val propertiesFile = rootProject.file("key.properties")
if (propertiesFile.exists()) {
load(propertiesFile.inputStream())
}
}
android {
namespace = "com.krowwithus.client"
compileSdk = flutter.compileSdkVersion
@@ -44,14 +52,32 @@ android {
versionCode = flutter.versionCode
versionName = flutter.versionName
manifestPlaceholders["GOOGLE_MAPS_API_KEY"] = dartEnvironmentVariables["GOOGLE_MAPS_API_KEY"] ?: ""
manifestPlaceholders["GOOGLE_MAPS_API_KEY"] = dartEnvironmentVariables["GOOGLE_MAPS_API_KEY"] ?: ""
}
signingConfigs {
create("release") {
if (System.getenv()["CI"] == "true") {
// CodeMagic CI environment
storeFile = file(System.getenv()["CM_KEYSTORE_PATH_CLIENT"] ?: "")
storePassword = System.getenv()["CM_KEYSTORE_PASSWORD_CLIENT"]
keyAlias = System.getenv()["CM_KEY_ALIAS_CLIENT"]
keyPassword = System.getenv()["CM_KEY_PASSWORD_CLIENT"]
} else {
// Local development environment
keyAlias = keystoreProperties["keyAlias"] as String?
keyPassword = keystoreProperties["keyPassword"] as String?
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"] as String?
}
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
signingConfig = signingConfigs.getByName("release")
}
}
}

View File

@@ -86,11 +86,11 @@
},
"oauth_client": [
{
"client_id": "933560802882-fbqg2icq24bmci3f84evjrbth5huh87f.apps.googleusercontent.com",
"client_id": "933560802882-qbl6keingmd14fepn6qp76agdmbr84fg.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.krowwithus.client",
"certificate_hash": "c3efbe1642239c599c16ad04c7fac340902fe280"
"certificate_hash": "f5491c60ec20eb27bb3ec581352ba653053f3740"
}
},
{
@@ -130,11 +130,11 @@
},
"oauth_client": [
{
"client_id": "933560802882-ikdfv3o5f47g36qqgvfq55o4m19n7gk4.apps.googleusercontent.com",
"client_id": "933560802882-nh589kkndmur9hgibkgg5g8lhmo7mg3v.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.krowwithus.staff",
"certificate_hash": "ac917ae8470ab29f1107c773c6017ff5ea5d102d"
"certificate_hash": "a6ef7fe8ade313e69377b178544192d835b29153"
}
},
{

View File

@@ -0,0 +1,9 @@
storePassword=krowwithus
keyPassword=krowwithus
keyAlias=krow_client_dev
storeFile=app/krow_with_us_client_dev.jks
###
### Client
### SHA1: F5:49:1C:60:EC:20:EB:27:BB:3E:C5:81:35:2B:A6:53:05:3F:37:40
### SHA256: 27:88:E4:EB:6C:BF:8E:25:66:37:76:B3:5D:DA:92:8A:CB:1A:6F:24:F3:38:9B:EA:DE:F0:25:62:FD:7A:7E:77