From b32bdf4d19d41be0e13bc2285a209b1d26dc0fc6 Mon Sep 17 00:00:00 2001 From: RuscalWorld Date: Wed, 26 May 2021 00:27:30 +0300 Subject: [PATCH] Publish on Modrinth --- .github/workflows/modrinth.yml | 20 ++++++++++++++++++++ build.gradle | 13 +++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/modrinth.yml diff --git a/.github/workflows/modrinth.yml b/.github/workflows/modrinth.yml new file mode 100644 index 0000000..67fd423 --- /dev/null +++ b/.github/workflows/modrinth.yml @@ -0,0 +1,20 @@ +name: Publish on Modrinth + +on: + release: + types: [ created ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle and publish on Modrinth + run: ./gradlew publish diff --git a/build.gradle b/build.gradle index 7a3bfb3..058d2fe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ import net.fabricmc.loom.task.RemapJarTask +import com.modrinth.minotaur.TaskModrinthUpload buildscript { dependencies { @@ -8,6 +9,7 @@ buildscript { plugins { id 'com.github.johnrengelman.shadow' version '6.1.0' + id "com.modrinth.minotaur" version "1.1.0" id 'fabric-loom' version '0.6-SNAPSHOT' id 'maven-publish' } @@ -94,3 +96,14 @@ task remapShadowJar(type: RemapJarTask, dependsOn: shadowJar) { } assemble.dependsOn(remapShadowJar) + +task publishModrinth(type: TaskModrinthUpload, dependsOn: remapShadowJar) { + onlyIf { System.getenv("MODRINTH_TOKEN") } + + token = System.getenv("MODRINTH_TOKEN") + projectId = 'dbVXHSlv' + versionNumber = project.mod_version + uploadFile = remapShadowJar + addGameVersion(project.minecraft_version) + addLoader('fabric') +} \ No newline at end of file