From f487cb4182df322ee94559139924d5505c407a50 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 2 Jul 2024 21:23:35 +0200 Subject: [PATCH] added modrinth publishing workflow --- .github/workflows/modrinth-publish.yml | 24 ++++++++++++++++++++++++ build.gradle.kts | 16 +++++++++++++++- gradle.properties | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) 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 00000000..b179563a --- /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/build.gradle.kts b/build.gradle.kts index 792cef3d..bec703b2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,6 +10,7 @@ plugins { id("io.papermc.hangar-publish-plugin") version "0.1.2" id("net.minecrell.plugin-yml.paper") version "0.6.0" id("xyz.jpenilla.run-paper") version "2.1.0" + id("com.modrinth.minotaur") version "2.+" } group = "net.thenextlvl.gopaint" @@ -84,6 +85,10 @@ tasks.runServer { 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("goPaintAdvanced") @@ -92,7 +97,7 @@ 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) dependencies { url("FastAsyncWorldEdit", "https://hangar.papermc.io/IntellectualSites/FastAsyncWorldEdit") { required.set(true) @@ -101,3 +106,12 @@ hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing } } } + +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") +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..3a752e69 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +gameVersions=1.20.6 \ No newline at end of file