Skip to content

Commit

Permalink
👷 Update CI to allow external PRs
Browse files Browse the repository at this point in the history
Updating the CI flow to build the app (which generates a release apk) to
run with fake credentials if the user has no access to the GitHub
secrets. This allows Alkaa to receive external PRs.
  • Loading branch information
igorescodro committed Aug 15, 2023
1 parent 9c74323 commit 09bec7e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ jobs:
env:
ALKAA_KEY_ALIAS: ${{ secrets.ALKAA_KEY_ALIAS }}
ALKAA_KEY_PASSWORD: ${{ secrets.ALKAA_KEY_PASSWORD }}
ALKAA_KEY_STORE_PASSWORD: ${{ secrets.ALKAA_KEY_STORE_PASSWORD }}
ALKAA_KEY_STORE_PASSWORD: ${{ secrets.ALKAA_KEY_ALIAS_PASSWORD }}
ALKAA_STORE_PATH: ${{ secrets.ALKAA_STORE_PATH }}
19 changes: 15 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.android.build.api.dsl.ManagedVirtualDevice
import com.android.build.gradle.internal.tasks.factory.dependsOn
import java.util.Properties

plugins {
id("com.android.application")
Expand All @@ -23,12 +24,13 @@ android {
setProperty("archivesBaseName", "${parent?.name}-$versionName")
}

val props = readProperties(file("../config/signing/signing.properties"))
signingConfigs {
create("release") {
keyAlias = System.getenv("ALKAA_KEY_ALIAS")
keyPassword = System.getenv("ALKAA_KEY_PASSWORD")
storeFile = file("../config/signing/alkaa-keystore")
storePassword = System.getenv("ALKAA_KEY_STORE_PASSWORD")
keyAlias = System.getenv("ALKAA_KEY_ALIAS") ?: props.getStringProperty("keyAlias")
keyPassword = System.getenv("ALKAA_KEY_PASSWORD") ?: props.getStringProperty("keyPassword")
storeFile = file(System.getenv("ALKAA_STORE_PATH") ?: props.getStringProperty("storePath"))
storePassword = System.getenv("ALKAA_KEY_STORE_PASSWORD") ?: props.getStringProperty("storePassword")
}
}

Expand Down Expand Up @@ -145,3 +147,12 @@ dependencies {
exclude(group = "androidx.lifecycle", module = "lifecycle-runtime")
}
}

fun readProperties(propertiesFile: File) = Properties().apply {
propertiesFile.inputStream().use { fis ->
load(fis)
}
}

fun Properties.getStringProperty(key: String): String =
getProperty(key) ?: throw IllegalStateException("Property $key not found")
4 changes: 4 additions & 0 deletions config/signing/signing.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
keyAlias=key0
keyPassword=alkaa123
storePath=../config/signing/testing-keystore
storePassword=alkaa123
Binary file added config/signing/testing-keystore
Binary file not shown.

0 comments on commit 09bec7e

Please sign in to comment.