3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 08:10:10 +01:00

Also handle release versions on publish

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-08-11 15:54:59 +10:00
Ursprung c053975535
Commit 725e505514

Datei anzeigen

@ -44,9 +44,15 @@ tasks {
publishShadowJar() publishShadowJar()
val branch = rootProject.branchName() val branch = rootProject.branchName()
val baseVersion = project.version as String
val isRelease = !baseVersion.contains('-')
val suffixedVersion = if (isRelease) baseVersion else baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
val changelogContent = if (isRelease) {
"See [GitHub](https://github.com/ViaVersion/ViaBackwards) for release notes."
} else {
rootProject.lastCommitMessage()
}
val isMainBranch = branch == "master" val isMainBranch = branch == "master"
val ver = (project.version as String) + "+" + System.getenv("GITHUB_RUN_NUMBER")
val changelogContent = rootProject.lastCommitMessage()
modrinth { modrinth {
// val snapshotVersion = rootProject.parseMinecraftSnapshotVersion(project.version as String) // val snapshotVersion = rootProject.parseMinecraftSnapshotVersion(project.version as String)
val mcVersions: List<String> = (property("mcVersions") as String) val mcVersions: List<String> = (property("mcVersions") as String)
@ -56,9 +62,9 @@ modrinth {
token.set(System.getenv("MODRINTH_TOKEN")) token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set("viabackwards") projectId.set("viabackwards")
versionType.set(if (isMainBranch) "beta" else "alpha") versionType.set(if (isRelease) "release" else if (isMainBranch) "beta" else "alpha")
versionNumber.set(ver) versionNumber.set(suffixedVersion)
versionName.set(ver) versionName.set(suffixedVersion)
changelog.set(changelogContent) changelog.set(changelogContent)
uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile }) uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile })
gameVersions.set(mcVersions) gameVersions.set(mcVersions)
@ -80,9 +86,9 @@ modrinth {
if (isMainBranch) { // Don't spam releases until Hangar has per channel notifications if (isMainBranch) { // Don't spam releases until Hangar has per channel notifications
hangarPublish { hangarPublish {
publications.register("plugin") { publications.register("plugin") {
version.set(ver) version.set(suffixedVersion)
namespace("ViaVersion", "ViaBackwards") namespace("ViaVersion", "ViaBackwards")
channel.set(if (isMainBranch) "Snapshot" else "Alpha") channel.set(if (isRelease) "Release" else if (isMainBranch) "Snapshot" else "Alpha")
changelog.set(changelogContent) changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN")) apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms { platforms {