Skip to content

Commit

Permalink
Implemented logic to get signing config in work flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsnappy1 committed Nov 6, 2024
1 parent cd9b396 commit 6047fbe
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ android {
}
}

val properties = Properties()
properties.load(rootProject.file("local.properties").inputStream())
signingConfigs {
create("release"){
keyAlias = "${properties["keyAlias"]}"
keyPassword = "${properties["keyPassword"]}"
keyAlias = getSecret("KEY_ALIAS")
keyPassword = getSecret("KEY_PASSWORD")
storeFile = file("keystore.jks")
storePassword = "${properties["storePassword"]}"
storePassword = getSecret("STORE_PASSWORD")
}
}

Expand Down Expand Up @@ -88,4 +86,18 @@ dependencies {

debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}

fun getSecret(name: String): String {
// Load passphrase from local.properties or environment variable
val properties = Properties()
val localPropertiesFile = project.rootProject.file("local.properties")

// Check if local.properties exists
if (localPropertiesFile.exists()) {
properties.load(localPropertiesFile.inputStream())
}

return properties.getProperty(name) ?: System.getenv(name)
?: throw GradleException("$name not found in local.properties or environment variables.")
}

0 comments on commit 6047fbe

Please sign in to comment.