Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷 Update the CI again #540

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@ android {
setProperty("archivesBaseName", "${parent?.name}-$versionName")
}

val props = readProperties(file("../config/signing/signing.properties"))
val properties = readProperties(file("../config/signing/signing.properties"))
signingConfigs {
create("release") {
keyAlias = System.getenv("ALKAA_KEY_ALIAS")
.ifEmpty { props.getStringProperty("keyAlias") }
keyPassword = System.getenv("ALKAA_KEY_PASSWORD")
.ifEmpty { props.getStringProperty("keyPassword") }
storeFile = file(System.getenv("ALKAA_STORE_PATH")
.ifEmpty { props.getStringProperty("storePath") })
storePassword = System.getenv("ALKAA_KEY_STORE_PASSWORD")
.ifEmpty { props.getStringProperty("storePassword") }
keyAlias = getSigningKey(properties, "ALKAA_KEY_ALIAS", "keyAlias")
keyPassword = getSigningKey(properties, "ALKAA_KEY_PASSWORD", "keyPassword")
storeFile = file(getSigningKey(properties, "ALKAA_STORE_PATH", "storePath"))
storePassword = getSigningKey(properties, "ALKAA_KEY_STORE_PASSWORD", "storePassword")
}
}

Expand Down Expand Up @@ -158,5 +154,9 @@ fun readProperties(propertiesFile: File) = Properties().apply {
}
}

fun Properties.getStringProperty(key: String): String =
getProperty(key) ?: throw IllegalStateException("Property $key not found")
fun getSigningKey(properties: Properties, secretKey: String, propertyKey: String): String =
if (!System.getenv(secretKey).isNullOrEmpty()) {
System.getenv(secretKey)
} else {
properties.getProperty(propertyKey)
}
Loading