1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Fixed GitHub Action run numbers and updated download url

This commit is contained in:
Tim203
2023-05-27 13:40:58 +02:00
parent 1b9042eacf
commit 202a30aae6
4 changed files with 38 additions and 20 deletions

View File

@@ -40,7 +40,7 @@ fun Project.lastCommitHash(): String? =
the<IndraGitExtension>().commit()?.name?.substring(0, 7)
fun Project.branchName(): String =
the<IndraGitExtension>().branchName() ?: System.getenv("BRANCH_NAME") ?: "local/dev"
the<IndraGitExtension>().branchName() ?: jenkinsBranchName() ?: "local/dev"
fun Project.shouldAddBranchName(): Boolean =
System.getenv("IGNORE_BRANCH")?.toBoolean() ?: (branchName() !in arrayOf("master", "local/dev"))
@@ -49,7 +49,7 @@ fun Project.versionWithBranchName(): String =
branchName().replace(Regex("[^0-9A-Za-z-_]"), "-") + '-' + version
fun buildNumber(): Int =
System.getenv("BUILD_NUMBER")?.let { Integer.parseInt(it) } ?: -1
(System.getenv("GITHUB_RUN_NUMBER") ?: jenkinsBuildNumber())?.let { Integer.parseInt(it) } ?: -1
fun buildNumberAsString(): String =
buildNumber().takeIf { it != -1 }?.toString() ?: "??"
@@ -78,4 +78,8 @@ fun Project.relocate(pattern: String) =
.add(pattern)
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
if (excludedOn and bit > 0) section else ""
if (excludedOn and bit > 0) section else ""
// todo remove these when we're not using Jenkins anymore
private fun jenkinsBranchName(): String? = System.getenv("BRANCH_NAME")
private fun jenkinsBuildNumber(): String? = System.getenv("BUILD_NUMBER")