Skip to content

Commit

Permalink
add keystore
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Oct 19, 2021
1 parent 741479b commit ca356f7
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build Release APK

on:
release:
types: [ published ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Build release APK
run: ./gradlew assembleRelease --warning-mode all --stacktrace

- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: app-release
path: app/build/outputs/apk/release/*.apk
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Validate Gradle Wrapper
on: [ push, pull_request ]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: gradle/[email protected]
4 changes: 2 additions & 2 deletions app/src/main/java/com/hoc/comicapp/ui/register/RegisterVM.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class RegisterVM(
private fun isValidUser(user: User): Boolean {
val (email, password, fullName) = user
return getEmailError(email) === null &&
getPasswordError(password) === null &&
getFullNameError(fullName) === null
getPasswordError(password) === null &&
getFullNameError(fullName) === null
}
}
51 changes: 51 additions & 0 deletions buildSrc/src/main/kotlin/com/hoc/comicapp/plugin/ComicAppPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import versions
import java.lang.System.getenv
import java.util.Properties

private inline val Project.libraryExtension get() = extensions.getByType<LibraryExtension>()
private inline val Project.appExtension get() = extensions.getByType<AppExtension>()
Expand Down Expand Up @@ -148,7 +150,54 @@ private fun Project.configAndroidApplication() = appExtension.run {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

signingConfigs {
getByName("debug") {
val keystoreProperties = Properties().apply {
load(
rootProject.file("keystore/debugkey.properties")
.apply { check(exists()) }
.reader()
)
}

keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = rootProject.file(keystoreProperties["storeFile"] as String).apply { check(exists()) }
storePassword = keystoreProperties["storePassword"] as String
}

create("release") {
val keystoreProperties by lazy {
Properties().apply {
load(
rootProject.file("keystore/debugkey.properties")
.apply { check(exists()) }
.reader()
)
}
}

keyAlias = getenv("keyAlias") ?: keystoreProperties["keyAlias"] as String
keyPassword = getenv("keyPassword") ?: keystoreProperties["keyPassword"] as String
storeFile = (getenv("storeFile")?.let { rootProject.file(it) }
?: rootProject.file(keystoreProperties["storeFile"] as String)).apply { check(exists()) }
storePassword = getenv("storePassword") ?: keystoreProperties["storePassword"] as String

// Optional, specify signing versions used
enableV1Signing = true
enableV2Signing = true
}
}

buildTypes {
getByName("debug") {
isMinifyEnabled = false
isShrinkResources = false

signingConfig = signingConfigs.getByName("debug")
isDebuggable = true
}

getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
Expand All @@ -157,6 +206,8 @@ private fun Project.configAndroidApplication() = appExtension.run {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
isDebuggable = false
}
}

Expand Down
Binary file added keystore/debug.jks
Binary file not shown.
4 changes: 4 additions & 0 deletions keystore/debugkey.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
storePassword=android
keyPassword=android
keyAlias=androiddebugkey
storeFile=keystore/debug.jks

0 comments on commit ca356f7

Please sign in to comment.