fix: handle empty env vars in release signing config

The signing config now properly falls back to debug keystore when
KEYSTORE_BASE64 is set but empty (as happens in CI without secrets).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Davide Ferrari
2025-12-22 17:18:51 +01:00
co-authored by Claude Opus 4.5
parent 63ca2295b0
commit 1939b69698
+8 -7
View File
@@ -22,14 +22,15 @@ android {
signingConfigs {
create("release") {
// CI: use secrets from environment variables
// Local: fall back to debug keystore
val keystorePath = System.getenv("KEYSTORE_BASE64")?.let { "release.keystore" }
?: "${System.getProperty("user.home")}/.android/debug.keystore"
// CI: use secrets from environment variables (if non-empty)
// Local/CI without secrets: fall back to debug keystore
val keystoreBase64 = System.getenv("KEYSTORE_BASE64")?.takeIf { it.isNotEmpty() }
val keystorePath = if (keystoreBase64 != null) "release.keystore"
else "${System.getProperty("user.home")}/.android/debug.keystore"
storeFile = file(keystorePath)
storePassword = System.getenv("KEYSTORE_PASSWORD") ?: "android"
keyAlias = System.getenv("KEY_ALIAS") ?: "androiddebugkey"
keyPassword = System.getenv("KEY_PASSWORD") ?: "android"
storePassword = System.getenv("KEYSTORE_PASSWORD")?.takeIf { it.isNotEmpty() } ?: "android"
keyAlias = System.getenv("KEY_ALIAS")?.takeIf { it.isNotEmpty() } ?: "androiddebugkey"
keyPassword = System.getenv("KEY_PASSWORD")?.takeIf { it.isNotEmpty() } ?: "android"
}
}