Skip to content

Commit ba2bb9d

Browse files
authored
Read signing config from env vars (#76)
1 parent ec68702 commit ba2bb9d

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

app/build.gradle.kts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,27 @@ if (hasGoogleServicesJson) {
99
apply(plugin = "com.google.firebase.crashlytics")
1010
}
1111

12+
fun getPropertyOrEnv(propertyName: String, envName: String = propertyName): String? {
13+
return if (project.hasProperty(propertyName)) {
14+
project.property(propertyName) as String
15+
} else {
16+
System.getenv(envName)
17+
}
18+
}
19+
1220
android {
1321
signingConfigs {
1422
create("release") {
15-
if (project.hasProperty("NETBIRD_UPLOAD_STORE_FILE")) {
16-
storeFile = file(project.property("NETBIRD_UPLOAD_STORE_FILE") as String)
17-
storePassword = project.property("NETBIRD_UPLOAD_STORE_PASSWORD") as String
18-
keyAlias = project.property("NETBIRD_UPLOAD_KEY_ALIAS") as String
19-
keyPassword = project.property("NETBIRD_UPLOAD_KEY_PASSWORD") as String
23+
val storeFile = getPropertyOrEnv("NETBIRD_UPLOAD_STORE_FILE")
24+
val storePassword = getPropertyOrEnv("NETBIRD_UPLOAD_STORE_PASSWORD")
25+
val keyAlias = getPropertyOrEnv("NETBIRD_UPLOAD_KEY_ALIAS")
26+
val keyPassword = getPropertyOrEnv("NETBIRD_UPLOAD_KEY_PASSWORD")
27+
28+
if (storeFile != null) {
29+
this.storeFile = file(storeFile)
30+
this.storePassword = storePassword
31+
this.keyAlias = keyAlias
32+
this.keyPassword = keyPassword
2033
}
2134
}
2235
}

0 commit comments

Comments
 (0)