Skip to content

Commit

Permalink
[ci skip] ci: change version scheme for snapshot builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Syrent committed Jun 2, 2024
1 parent 4131e8c commit ba914d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ fun latestCommitMessage(): String {
val versionString: String = findProperty("version")!! as String
val isRelease: Boolean = (System.getenv("HANGAR_BUILD_CHANNEL") ?: "Snapshot") == "Release"

val suffixedVersion: String = if (isRelease) {
versionString
} else {
"$versionString-SNAPSHOT"
}

val publishVersion = if (isRelease) suffixedVersion else "$versionString-build.${System.getenv("GITHUB_RUN_NUMBER")}"
val publishVersion = if (isRelease) versionString else "$versionString-build.${System.getenv("GITHUB_RUN_NUMBER")}"
val commitVersion = publishVersion + "-" + (System.getenv("GITHUB_SHA")?.substring(0, 7) ?: "local")
version = commitVersion

Expand Down Expand Up @@ -131,7 +125,7 @@ subprojects {
create<MavenPublication>("maven") {
shadow.component(this)
artifact(tasks["sourcesJar"])
this.version = suffixedVersion
this.version = versionString
setPom(this)
}
}
Expand Down Expand Up @@ -178,7 +172,7 @@ fun setPom(publication: MavenPublication) {

hangarPublish {
publications.register("plugin") {
version.set(if (isRelease) suffixedVersion else publishVersion)
version.set(if (isRelease) versionString else publishVersion)
channel.set(System.getenv("HANGAR_BUILD_CHANNEL") ?: "Snapshot")
changelog.set(if (System.getenv("HANGAR_CHANGELOG").isNullOrEmpty()) changelogContent else System.getenv("HANGAR_CHANGELOG"))
id.set(slug)
Expand Down Expand Up @@ -209,7 +203,7 @@ modrinth {

token.set(modrinthApiKey)
projectId.set("${property("modrinthProjectID")}")
versionNumber.set(if (isRelease) suffixedVersion else publishVersion)
versionNumber.set(if (isRelease) versionString else publishVersion)
versionType.set(System.getenv("MODRINTH_BUILD_CHANNEL") ?: "beta")
uploadFile.set(project(":sayanvanish-bukkit").tasks.shadowJar.flatMap { it.archiveFile })
additionalFiles.set(listOf(
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ description=A modular vanish system for Minecraft servers
website=https://sayandev.org
author=Syrent

version=1.0.0-rc.7
version=1.0.0-rc.8-SNAPSHOT

0 comments on commit ba914d5

Please sign in to comment.