[ci skip] Only publish releases from the main branch

This commit is contained in:
Nassim Jahnke 2023-09-22 15:32:14 +10:00
parent 489b28e520
commit e30dd63b3c
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -46,15 +46,17 @@ publishShadowJar()
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) {
val isMainBranch = branch == "master"
if (!isRelease || isMainBranch) { // Only publish releases from the main branch
val suffixedVersion = if (isRelease) baseVersion else baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
val changelogContent = if (isRelease) {
"See [GitHub](https://github.com/ViaVersion/ViaVersion) for release notes."
} else {
} else {
val commitHash = rootProject.latestCommitHash()
"[$commitHash](https://github.com/ViaVersion/ViaVersion/commit/$commitHash) ${rootProject.latestCommitMessage()}"
}
val isMainBranch = branch == "master"
modrinth {
}
modrinth {
val mcVersions: List<String> = (property("mcVersions") as String)
.split(",")
.map { it.trim() }
@ -78,9 +80,9 @@ modrinth {
optional.project("viafabric")
optional.project("viafabricplus")
}
}
}
hangarPublish {
hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
id.set("ViaVersion")
@ -102,4 +104,5 @@ hangarPublish {
}
}
}
}
}