diff --git a/build.gradle.kts b/build.gradle.kts index 722a330..f1c0b81 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,65 @@ plugins { + alias(libs.plugins.minotaur) + alias(libs.plugins.hangar) + `root-plugin` +} + +val buildNumber: String? = System.getenv("BUILD_NUMBER") + +rootProject.version = if (buildNumber != null) "3.12-$buildNumber" else "3.12" + +val isSnapshot = false + +val content: String = rootProject.file("CHANGELOG.md").readText(Charsets.UTF_8) + +modrinth { + token.set(System.getenv("MODRINTH_TOKEN")) + + projectId.set(rootProject.name.lowercase()) + + versionType.set(if (isSnapshot) "beta" else "release") + + versionName.set("${rootProject.name} ${rootProject.version}") + versionNumber.set(rootProject.version as String) + + changelog.set(content) + + uploadFile.set(rootProject.projectDir.resolve("jars/${rootProject.name}-${rootProject.version}.jar")) + + gameVersions.set(listOf(libs.versions.minecraft.get())) + + loaders.add("paper") + loaders.add("purpur") + + autoAddDependsOn.set(false) + detectLoaders.set(false) +} + +hangarPublish { + publications.register("plugin") { + apiKey.set(System.getenv("HANGAR_KEY")) + + id.set(rootProject.name.lowercase()) + + version.set(rootProject.version as String) + + channel.set(if (isSnapshot) "Snapshot" else "Release") + + changelog.set(content) + + platforms { + paper { + jar.set(rootProject.projectDir.resolve("jars/${rootProject.name}-${rootProject.version}.jar")) + + platformVersions.set(listOf(libs.versions.minecraft.get())) + + dependencies { + hangar("PlaceholderAPI") { + required = false + } + } + } + } + } } \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4a318ac..51b54c6 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -9,6 +9,4 @@ repositories { dependencies { implementation(libs.paperweight.userdev) - implementation(libs.publishing.modrinth) - implementation(libs.publishing.hangar) } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/fabric-plugin.gradle.kts b/buildSrc/src/main/kotlin/fabric-plugin.gradle.kts deleted file mode 100644 index ad3acef..0000000 --- a/buildSrc/src/main/kotlin/fabric-plugin.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - id("root-plugin") -} - -val mcVersion = providers.gradleProperty("mcVersion").get() -val fabricVersion = providers.gradleProperty("version").get() - -project.version = if (System.getenv("BUILD_NUMBER") != null) "$fabricVersion-${System.getenv("BUILD_NUMBER")}" else fabricVersion - -tasks { - modrinth { - loaders.addAll("fabric") - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/paper-plugin.gradle.kts b/buildSrc/src/main/kotlin/paper-plugin.gradle.kts index 93979d0..4c63e65 100644 --- a/buildSrc/src/main/kotlin/paper-plugin.gradle.kts +++ b/buildSrc/src/main/kotlin/paper-plugin.gradle.kts @@ -14,14 +14,4 @@ repositories { maven("https://repo.fancyplugins.de/releases/") flatDir { dirs("libs") } -} - -val mcVersion = providers.gradleProperty("mcVersion").get() - -project.version = if (System.getenv("BUILD_NUMBER") != null) "${rootProject.version}-${System.getenv("BUILD_NUMBER")}" else rootProject.version - -tasks { - modrinth { - loaders.addAll("paper", "purpur") - } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/root-plugin.gradle.kts b/buildSrc/src/main/kotlin/root-plugin.gradle.kts index b42ff2d..dcc1203 100644 --- a/buildSrc/src/main/kotlin/root-plugin.gradle.kts +++ b/buildSrc/src/main/kotlin/root-plugin.gradle.kts @@ -1,10 +1,4 @@ -import io.papermc.hangarpublishplugin.model.Platforms - plugins { - id("io.papermc.hangar-publish-plugin") - - id("com.modrinth.minotaur") - `java-library` `maven-publish` @@ -41,53 +35,4 @@ tasks { processResources { filteringCharset = Charsets.UTF_8.name() } - - val directory = File("$rootDir/jars/${project.name.lowercase()}") - val mcVersion = providers.gradleProperty("mcVersion").get() - - val isBeta: Boolean = providers.gradleProperty("isBeta").get().toBoolean() - val type = if (isBeta) "Beta" else "Release" - - // Publish to hangar.papermc.io. - hangarPublish { - publications.register("plugin") { - version.set("${project.version}") - - id.set(rootProject.name) - - channel.set(type) - - changelog.set(rootProject.file("CHANGELOG.md").readText(Charsets.UTF_8)) - - apiKey.set(System.getenv("hangar_key")) - - platforms { - register(Platforms.PAPER) { - jar.set(file("$directory/${rootProject.name}-${project.version}.jar")) - - platformVersions.set(listOf(mcVersion)) - } - } - } - } - - modrinth { - versionType.set(type.lowercase()) - - autoAddDependsOn.set(false) - - token.set(System.getenv("modrinth_token")) - - projectId.set(rootProject.name.lowercase()) - - changelog.set(rootProject.file("CHANGELOG.md").readText(Charsets.UTF_8)) - - versionName.set("${rootProject.name} ${project.version}") - - versionNumber.set("${project.version}") - - uploadFile.set("$directory/${rootProject.name}-${project.version}.jar") - - gameVersions.add(mcVersion) - } } \ No newline at end of file