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/build.gradle.kts b/build.gradle.kts index 563e576..765444b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id("io.github.goooler.shadow") version "8.1.7" id("net.minecrell.plugin-yml.paper") version "0.6.0" id("io.papermc.hangar-publish-plugin") version "0.1.2" + id("com.modrinth.minotaur") version "2.+" } group = "net.thenextlvl" @@ -163,6 +164,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("Tweaks") @@ -171,9 +176,6 @@ 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 }) - val versions: List = (property("paperVersion") as String) - .split(",") - .map { it.trim() } platformVersions.set(versions) dependencies { url("LuckPerms", "https://luckperms.net/") { @@ -183,3 +185,17 @@ hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing } } } + +modrinth { + token.set(System.getenv("MODRINTH_TOKEN")) + projectId.set("HLkJsjy0") + versionType = if (isRelease) "release" else "beta" + uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile }) + gameVersions.set(versions) + loaders.add("paper") + loaders.add("folia") + syncBodyFrom.set(rootProject.file("README.md").readText()) + dependencies { + optional.project("luckperms") + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index befb5b9..235f4f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style=official -paperVersion=1.20.5 \ No newline at end of file +gameVersions=1.20.6 \ No newline at end of file