Skip to content

Commit

Permalink
Add release settings
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Sep 25, 2022
1 parent 0fe61bc commit afb7b62
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ Footer
kotlin-js-store/

# Moko resource
**/moko-resources-generated.js
**/moko-resources-generated.js

# Android Key
app-android/src/prod/google-services.json
keystore.properties
prod.keystore

19 changes: 19 additions & 0 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.android.build.api.variant.ResValue
import java.io.FileInputStream
import java.util.Properties

plugins {
id("droidkaigi.primitive.androidapplication")
Expand All @@ -13,6 +15,7 @@ plugins {

android.namespace = "io.github.droidkaigi.confsched2022"

val keystorePropertiesFile = rootProject.file("keystore.properties")
android {
flavorDimensions += "network"
signingConfigs {
Expand All @@ -22,6 +25,17 @@ android {
keyAlias = "androiddebugkey"
keyPassword = "android"
}

if(keystorePropertiesFile.exists()) {
val keystoreProperties = Properties()
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
getByName("prod") {
keyAlias = keystoreProperties["keyAlias"] as String?
keyPassword = keystoreProperties["keyPassword"] as String?
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
storePassword = keystoreProperties["storePassword"] as String?
}
}
}
productFlavors {
create("dev") {
Expand All @@ -32,6 +46,11 @@ android {
}
create("prod") {
dimension = "network"
if(keystorePropertiesFile.exists()) {
signingConfig = signingConfigs.getByName("prod")
} else {
signingConfig = signingConfigs.getByName("dev")
}
}
}
buildTypes {
Expand Down
10 changes: 10 additions & 0 deletions app-android/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
cd "$(dirname "$0")"
cp $1/keystore.properties .
cp $1/prod.keystore .
mkdir src/prod/
cp $1/google-services.json src/prod/google-services.json

cd ..
./gradlew app-android:assembleProdRelease -Pbuildkonfig.flavor=prod
./gradlew app-android:bundleProdRelease -Pbuildkonfig.flavor=prod

0 comments on commit afb7b62

Please sign in to comment.