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