1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2025-12-21 07:49:32 +00:00

Feature: Modrinth version names (#4989)

* Feature: Version names on modrinth published builds

* Also change the fabric/neoforge jar file names
This commit is contained in:
chris
2024-08-25 21:31:03 +02:00
committed by GitHub
parent 2274377814
commit efe8077093
4 changed files with 13 additions and 6 deletions

View File

@@ -118,3 +118,12 @@ open class DownloadFilesTask : DefaultTask() {
private fun calcExclusion(section: String, bit: Int, excludedOn: Int): String =
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

View File

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

View File

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