Update beta version number logic

Previously it would just take the latest release and make the beta count based on the commits. Now if there is a previous beta version tag, its however many commits were made since the last beta tag
This commit is contained in:
Jays2Kings 2023-03-20 01:28:34 -04:00
parent 1293adf624
commit e0be6e57b1

View file

@ -12,8 +12,14 @@ fun Project.getCommitCount(): String {
} }
fun Project.getCommitCountSinceLastRelease(): String { fun Project.getCommitCountSinceLastRelease(): String {
val lastTag = runCommand("git describe --tags --abbrev=0") val betaTags = runCommand("git tag -l --sort=refname v${AndroidVersions.versionName}-b*")
return runCommand("git rev-list --count $lastTag..HEAD").toIntOrNull()?.toString() ?: "1" return if (betaTags.isNotEmpty()) {
val betaTag = betaTags.split("\n").last()
runCommand("git rev-list --count $betaTag..HEAD").toIntOrNull()?.toString() ?: "1"
} else {
val lastTag = runCommand("git describe --tags --abbrev=0")
runCommand("git rev-list --count $lastTag..HEAD").toIntOrNull()?.toString() ?: "1"
}
// return "1" // return "1"
} }