Merge pull request #12963 from t895/versioning-fix

android: Fix regex for git version
merge-requests/60/head
liamwhite 2024-02-08 17:03:32 +07:00 committed by GitHub
commit 71e59bdcd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

@ -259,13 +259,20 @@ fun runGitCommand(command: List<String>): String {
}
fun getGitVersion(): String {
val gitVersion = runGitCommand(listOf("git", "describe", "--always", "--long"))
val gitVersion = runGitCommand(
listOf(
"git",
"describe",
"--always",
"--long"
)
).replace(Regex("(-0)?-[^-]+$"), "")
val versionName = if (System.getenv("GITHUB_ACTIONS") != null) {
System.getenv("GIT_TAG_NAME") ?: gitVersion
} else {
gitVersion
}
return versionName.replace(Regex("(-0)?-[^-]+$"), "").ifEmpty { "0.0" }
return versionName.ifEmpty { "0.0" }
}
fun getGitHash(): String =