Skip to content

Commit c0e4d7e

Browse files
committed
ci: use built-in debug signing configuration as fallback when custom keystore is missing
1 parent 7e4d00f commit c0e4d7e

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

app/build.gradle.kts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ android {
3333
storePassword = System.getenv("STORE_PASSWORD")
3434
keyAlias = "upload"
3535
keyPassword = System.getenv("KEY_PASSWORD")
36-
} else {
37-
// Fallback to debug configuration if release keystore is missing
38-
storeFile = file("${rootDir}/debug.keystore")
39-
storePassword = "android"
40-
keyAlias = "androiddebugkey"
41-
keyPassword = "android"
4236
}
4337
}
4438
create("debugConfig") {
@@ -54,9 +48,23 @@ android {
5448
isCrunchPngs = false
5549
isMinifyEnabled = false
5650
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
57-
signingConfig = signingConfigs.getByName("release")
51+
52+
val releaseSigning = signingConfigs.findByName("release")
53+
if (releaseSigning != null && releaseSigning.storeFile != null && releaseSigning.storeFile!!.exists()) {
54+
signingConfig = releaseSigning
55+
} else {
56+
// Fallback to AGP's built-in debug signing config (which uses ~/.android/debug.keystore)
57+
signingConfig = signingConfigs.getByName("debug")
58+
}
59+
}
60+
debug {
61+
val debugKeystore = file("${rootDir}/debug.keystore")
62+
if (debugKeystore.exists()) {
63+
signingConfig = signingConfigs.getByName("debugConfig")
64+
} else {
65+
signingConfig = signingConfigs.getByName("debug")
66+
}
5867
}
59-
debug { signingConfig = signingConfigs.getByName("debugConfig") }
6068
}
6169
compileOptions {
6270
sourceCompatibility = JavaVersion.VERSION_11

0 commit comments

Comments
 (0)