From 5e6f64bc7fdba423c4cea32bdfe9547752d4bef8 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 28 Jun 2024 15:51:15 +0200 Subject: [PATCH] added modrinth publishing --- .github/workflows/modrinth-publish.yml | 24 ++++++++++++++++++++++++ api/build.gradle.kts | 2 +- gradle.properties | 1 + plugin/build.gradle.kts | 16 +++++++++++++++- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/modrinth-publish.yml create mode 100644 gradle.properties diff --git a/.github/workflows/modrinth-publish.yml b/.github/workflows/modrinth-publish.yml new file mode 100644 index 0000000..b179563 --- /dev/null +++ b/.github/workflows/modrinth-publish.yml @@ -0,0 +1,24 @@ +name: Modrinth Publish + +on: + release: + types: + - prereleased + - released + +jobs: + build: + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + - name: Publish with Gradle to Modrinth + uses: gradle/actions/setup-gradle@v3 + with: + arguments: modrinth \ No newline at end of file diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 7e62bfa..b460484 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -11,7 +11,7 @@ java { } group = "net.thenextlvl.worlds" -version = "1.2.2" +version = "1.2.3" repositories { mavenCentral() diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..3a752e6 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +gameVersions=1.20.6 \ No newline at end of file diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 6e51c1d..3d0a362 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("io.papermc.hangar-publish-plugin") version "0.1.2" id("net.minecrell.plugin-yml.paper") version "0.6.0" id("io.github.goooler.shadow") version "8.1.7" + id("com.modrinth.minotaur") version "2.+" } java { @@ -84,6 +85,10 @@ paper { val versionString: String = project.version as String val isRelease: Boolean = !versionString.contains("-pre") +val versions: List = (property("gameVersions") as String) + .split(",") + .map { it.trim() } + hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing publications.register("plugin") { id.set("Worlds") @@ -92,7 +97,16 @@ hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing apiKey.set(System.getenv("HANGAR_API_TOKEN")) platforms.register(Platforms.PAPER) { jar.set(tasks.shadowJar.flatMap { it.archiveFile }) - platformVersions.set(listOf("1.20.6")) + platformVersions.set(versions) } } +} + +modrinth { + token.set(System.getenv("MODRINTH_TOKEN")) + projectId.set("gBIw3Gvy") + versionType = if (isRelease) "release" else "beta" + uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile }) + gameVersions.set(versions) + loaders.add("paper") } \ No newline at end of file