3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-16 04:50:07 +01:00

Feature: Modrinth version names (#4989)

* Feature: Version names on modrinth published builds

* Also change the fabric/neoforge jar file names
Dieser Commit ist enthalten in:
chris 2024-08-25 21:31:03 +02:00 committet von GitHub
Ursprung 2274377814
Commit efe8077093
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
4 geänderte Dateien mit 13 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -118,3 +118,12 @@ open class DownloadFilesTask : DefaultTask() {
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String = private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
if (excludedOn and bit > 0) section else "" if (excludedOn and bit > 0) section else ""
fun projectVersion(project: Project): String =
project.version.toString().replace("SNAPSHOT", "b" + buildNumber())
fun versionName(project: Project): String =
"Geyser-" + project.name.replaceFirstChar { it.uppercase() } + "-" + projectVersion(project)
fun buildNumber(): Int =
(System.getenv("BUILD_NUMBER"))?.let { Integer.parseInt(it) } ?: -1

Datei anzeigen

@ -87,7 +87,7 @@ tasks {
register("remapModrinthJar", RemapJarTask::class) { register("remapModrinthJar", RemapJarTask::class) {
dependsOn(shadowJar) dependsOn(shadowJar)
inputFile.set(shadowJar.get().archiveFile) inputFile.set(shadowJar.get().archiveFile)
archiveVersion.set(project.version.toString() + "+build." + System.getenv("BUILD_NUMBER")) archiveVersion.set(versionName(project))
archiveClassifier.set("") archiveClassifier.set("")
} }
} }

Datei anzeigen

@ -8,7 +8,8 @@ tasks.modrinth.get().dependsOn(tasks.modrinthSyncBody)
modrinth { modrinth {
token.set(System.getenv("MODRINTH_TOKEN") ?: "") // Even though this is the default value, apparently this prevents GitHub Actions caching the token? token.set(System.getenv("MODRINTH_TOKEN") ?: "") // Even though this is the default value, apparently this prevents GitHub Actions caching the token?
projectId.set("geyser") projectId.set("geyser")
versionNumber.set(project.version as String + "-" + System.getenv("BUILD_NUMBER")) versionName.set(versionName(project))
versionNumber.set(projectVersion(project))
versionType.set("beta") versionType.set("beta")
changelog.set(System.getenv("CHANGELOG") ?: "") changelog.set(System.getenv("CHANGELOG") ?: "")
gameVersions.addAll("1.21", libs.minecraft.get().version as String) gameVersions.addAll("1.21", libs.minecraft.get().version as String)

Datei anzeigen

@ -103,9 +103,6 @@ sourceSets {
} }
} }
fun buildNumber(): Int =
(System.getenv("BUILD_NUMBER"))?.let { Integer.parseInt(it) } ?: -1
fun isDevBuild(branch: String, repository: String): Boolean { fun isDevBuild(branch: String, repository: String): Boolean {
return branch != "master" || repository.equals("https://github.com/GeyserMC/Geyser", ignoreCase = true).not() return branch != "master" || repository.equals("https://github.com/GeyserMC/Geyser", ignoreCase = true).not()
} }
@ -139,7 +136,7 @@ inner class GitInfo {
buildNumber = buildNumber() buildNumber = buildNumber()
isDev = isDevBuild(branch, repository) isDev = isDevBuild(branch, repository)
val projectVersion = if (isDev) project.version else project.version.toString().replace("SNAPSHOT", "b${buildNumber}") val projectVersion = if (isDev) project.version else projectVersion(project)
version = "$projectVersion ($gitVersion)" version = "$projectVersion ($gitVersion)"
} }
} }