aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/android
diff options
context:
space:
mode:
authort895 <[email protected]>2024-01-17 15:12:30 -0500
committert895 <[email protected]>2024-02-04 10:54:18 -0500
commit99ea31faa855df2df0d3922f6ce4182784870d5b (patch)
tree4f1810341ef93318b5dcb8464c0680664bbcf3ba /src/android
parent6baf965777145fd9c76bd06a3c140afa46a50e87 (diff)
downloadyuzu-android-99ea31faa855df2df0d3922f6ce4182784870d5b.tar.gz
yuzu-android-99ea31faa855df2df0d3922f6ce4182784870d5b.zip
ci: android: Play store publishing setup
Diffstat (limited to 'src/android')
-rw-r--r--src/android/app/build.gradle.kts31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts
index 188ef9469..d44bb4c74 100644
--- a/src/android/app/build.gradle.kts
+++ b/src/android/app/build.gradle.kts
@@ -3,8 +3,8 @@
import android.annotation.SuppressLint
import kotlin.collections.setOf
-import org.jetbrains.kotlin.konan.properties.Properties
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
+import com.github.triplet.gradle.androidpublisher.ReleaseStatus
plugins {
id("com.android.application")
@@ -13,6 +13,7 @@ plugins {
kotlin("plugin.serialization") version "1.9.20"
id("androidx.navigation.safeargs.kotlin")
id("org.jlleitschuh.gradle.ktlint") version "11.4.0"
+ id("com.github.triplet.play") version "3.8.6"
}
/**
@@ -58,15 +59,7 @@ android {
targetSdk = 34
versionName = getGitVersion()
- // If you want to use autoVersion for the versionCode, create a property in local.properties
- // named "autoVersioned" and set it to "true"
- val properties = Properties()
- val versionProperty = try {
- properties.load(project.rootProject.file("local.properties").inputStream())
- properties.getProperty("autoVersioned") ?: ""
- } catch (e: Exception) { "" }
-
- versionCode = if (versionProperty == "true") {
+ versionCode = if (System.getenv("AUTO_VERSIONED") == "true") {
autoVersion
} else {
1
@@ -221,6 +214,15 @@ ktlint {
}
}
+play {
+ val keyPath = System.getenv("SERVICE_ACCOUNT_KEY_PATH")
+ if (keyPath != null) {
+ serviceAccountCredentials.set(File(keyPath))
+ }
+ track.set(System.getenv("STORE_TRACK") ?: "internal")
+ releaseStatus.set(ReleaseStatus.COMPLETED)
+}
+
dependencies {
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
@@ -257,14 +259,13 @@ fun runGitCommand(command: List<String>): String {
}
fun getGitVersion(): String {
+ val gitVersion = runGitCommand(listOf("git", "describe", "--always", "--long"))
val versionName = if (System.getenv("GITHUB_ACTIONS") != null) {
- val gitTag = System.getenv("GIT_TAG_NAME") ?: ""
- gitTag
+ System.getenv("GIT_TAG_NAME") ?: gitVersion
} else {
- runGitCommand(listOf("git", "describe", "--always", "--long"))
- .replace(Regex("(-0)?-[^-]+$"), "")
+ gitVersion
}
- return versionName.ifEmpty { "0.0" }
+ return versionName.replace(Regex("(-0)?-[^-]+$"), "").ifEmpty { "0.0" }
}
fun getGitHash(): String =