Skip to content

Commit

Permalink
Use keystore properties from github when build is from CI. And load l…
Browse files Browse the repository at this point in the history
…ocally when build is not CI.
  • Loading branch information
Diar Gegaj committed Oct 12, 2023
1 parent 3eec1e6 commit a994325
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import java.io.FileInputStream
import java.util.Properties

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
Expand All @@ -6,16 +9,30 @@ plugins {
id("com.google.gms.google-services")
}

val keystoreProperties = Properties()
val keystoreFile = rootProject.file("keystore.properties")

if (keystoreFile.exists()) {
keystoreProperties.load(FileInputStream(keystoreFile))
}

android {
namespace = "com.diargegaj.recipesharing"
compileSdk = 34

signingConfigs {
create("release") {
storeFile = file(System.getenv("KEYSTORE_PATH") ?: "")
storePassword = System.getenv("STORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
if (System.getenv("CI") == "true") {
storeFile = file(System.getenv("KEYSTORE_PATH") ?: "")
storePassword = System.getenv("STORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
} else {
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"].toString()
keyAlias = keystoreProperties["keyAlias"].toString()
keyPassword = keystoreProperties["keyPassword"].toString()
}
}
}

Expand Down

0 comments on commit a994325

Please sign in to comment.