mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-22 14:56:25 +01: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:
parent
2274377814
commit
efe8077093
4 changed files with 13 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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("")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -103,9 +103,6 @@ sourceSets {
|
|||
}
|
||||
}
|
||||
|
||||
fun buildNumber(): Int =
|
||||
(System.getenv("BUILD_NUMBER"))?.let { Integer.parseInt(it) } ?: -1
|
||||
|
||||
fun isDevBuild(branch: String, repository: String): Boolean {
|
||||
return branch != "master" || repository.equals("https://github.com/GeyserMC/Geyser", ignoreCase = true).not()
|
||||
}
|
||||
|
@ -139,7 +136,7 @@ inner class GitInfo {
|
|||
|
||||
buildNumber = buildNumber()
|
||||
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)"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue