mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-07 10:49:08 +01:00
Merge pull request #12963 from t895/versioning-fix
android: Fix regex for git version
This commit is contained in:
commit
71e59bdcd8
1 changed files with 9 additions and 2 deletions
|
@ -259,13 +259,20 @@ fun runGitCommand(command: List<String>): String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGitVersion(): 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) {
|
val versionName = if (System.getenv("GITHUB_ACTIONS") != null) {
|
||||||
System.getenv("GIT_TAG_NAME") ?: gitVersion
|
System.getenv("GIT_TAG_NAME") ?: gitVersion
|
||||||
} else {
|
} else {
|
||||||
gitVersion
|
gitVersion
|
||||||
}
|
}
|
||||||
return versionName.replace(Regex("(-0)?-[^-]+$"), "").ifEmpty { "0.0" }
|
return versionName.ifEmpty { "0.0" }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGitHash(): String =
|
fun getGitHash(): String =
|
||||||
|
|
Loading…
Reference in a new issue