diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 33ed2fa9..af84168e 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -27,6 +27,6 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Publish to Modrinth - run: ./gradlew modrinth --stacktrace + run: ./gradlew modrinthPublish --stacktrace - name: Publish to Hangar run: ./gradlew publishPluginPublicationToHangar --stacktrace \ No newline at end of file diff --git a/BANNER.md b/BANNER.md index 3efde73a..a3ed21d8 100644 --- a/BANNER.md +++ b/BANNER.md @@ -1,4 +1,4 @@ -
+
![-0001-export](https://github.com/toxicity188/BetterHud/assets/114675706/ccbf4bd3-9133-44ee-b277-985eae4349ae) diff --git a/README.md b/README.md index 548df807..9b448e27 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -
+
![-0001-export](https://github.com/toxicity188/BetterHud/assets/114675706/ccbf4bd3-9133-44ee-b277-985eae4349ae) @@ -47,7 +47,8 @@ This project implements a server-side HUD. Requires Java 17, 21 Eclipse Adoptium. - Build all available jar: ./gradlew build -- Build Bukkit plugin: ./gradlew pluginJar +- Build Bukkit plugin: ./gradlew pluginJar +- Build Velocity plugin: ./gradlew velocityJar - Build Fabric server side mod: ./gradlew fabricJar - Build source code jar: ./gradlew sourceJar - Build dokka-based docs jar: ./gradlew dokkaJar diff --git a/build.gradle.kts b/build.gradle.kts index b0a78114..696e67e4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -206,6 +206,27 @@ fun Project.legacy() = also { toolchain.languageVersion = JavaLanguageVersion.of(17) } } +fun Project.modrinthPublish(depend: Jar, additionalJar: List, supports: List) { + apply(plugin = "com.modrinth.minotaur") + tasks.modrinth { + dependsOn( + depend + ) + } + modrinth { + token = System.getenv("MODRINTH_API_TOKEN") + projectId = "betterhud2" + versionType = "alpha" + changelog = System.getenv("COMMIT_MESSAGE") + versionNumber = project.version as String + uploadFile.set(depend.archiveFile) + additionalFiles = additionalJar.map { + it.archiveFile + } + gameVersions = supportedMinecraftVersions + loaders = supports + } +} val apiShare = project("api:standard-api").adventure().legacy() val apiBukkit = project("api:bukkit-api").adventure().bukkit().dependency(apiShare).legacy() @@ -307,9 +328,7 @@ val fabricJar by tasks.creating(Jar::class.java) { } } val pluginJar by tasks.creating(Jar::class.java) { - from(zipTree(velocityBootstrap.tasks.jar.map { - it.archiveFile - })) + archiveClassifier = "bukkit" from(zipTree(bukkitBootstrap.tasks.jar.map { it.archiveFile })) @@ -338,6 +357,18 @@ val pluginJar by tasks.creating(Jar::class.java) { relocateAll() } } +val velocityJar by tasks.creating(Jar::class.java) { + archiveClassifier = "velocity" + from(zipTree(velocityBootstrap.tasks.jar.map { + it.archiveFile + })) + from(zipTree(tasks.shadowJar.map { + it.archiveFile + })) + doLast { + relocateAll() + } +} fun Jar.relocateAll() { val file = archiveFile.get().asFile @@ -375,10 +406,7 @@ tasks { pluginJars(fileTree("plugins")) } build { - finalizedBy(sourceJar) - finalizedBy(dokkaJar) - finalizedBy(pluginJar) - finalizedBy(fabricJar) + finalizedBy(sourceJar, dokkaJar, pluginJar, velocityJar, fabricJar) } logLinkDokkaGeneratePublicationHtml { enabled = false @@ -390,15 +418,33 @@ tasks { } } -tasks.modrinth { +bukkitBootstrap.modrinthPublish( + pluginJar, + listOf(sourceJar, dokkaJar), + listOf("bukkit", "spigot", "paper", "purpur", "folia") +) + +velocityBootstrap.modrinthPublish( + velocityJar, + listOf(sourceJar, dokkaJar), + listOf("velocity") +) +fabricBootstrap.modrinthPublish( + fabricJar, + listOf(sourceJar, dokkaJar), + listOf("fabric", "qulit") +) + +tasks.create("modrinthPublish") { dependsOn( tasks.shadowJar, sourceJar, dokkaJar, - pluginJar, - fabricJar, tasks.modrinthSyncBody ) + bootstrap.forEach { + dependsOn(it.modrinth) + } } hangarPublish { @@ -422,18 +468,5 @@ hangarPublish { } modrinth { - token = System.getenv("MODRINTH_API_TOKEN") - projectId = "betterhud2" - versionType = "alpha" - changelog = System.getenv("COMMIT_MESSAGE") - versionNumber = project.version as String - uploadFile.set(file("build/libs/${project.name}-${project.version}.jar")) - additionalFiles = listOf( - file("build/libs/${project.name}-${project.version}-dokka.jar"), - file("build/libs/${project.name}-${project.version}-source.jar"), - file("build/libs/${project.name}-${project.version}-fabric+$minecraft.jar") - ) - gameVersions = supportedMinecraftVersions - loaders = listOf("bukkit", "spigot", "paper", "purpur", "folia", "velocity") syncBodyFrom = rootProject.file("BANNER.md").readText() } \ No newline at end of file