diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f7bcfb1c..ff1156ee4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,10 +9,11 @@ jobs: steps: - uses: actions/checkout@v1 - uses: gradle/wrapper-validation-action@v1 - - run: ./gradlew checkVersion build publish curseforge github --stacktrace + - run: ./gradlew checkVersion build publish curseforge github modrinth --stacktrace env: MAVEN_URL: ${{ secrets.MAVEN_URL }} MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} GITHUB_TOKEN: ${{ secrets.GH_API_KEY }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} diff --git a/README.md b/README.md index 847cf1217..24dbae098 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ For support and discussion for both developers and users, visit [the Fabric Disc Make sure you have install fabric loader first. More information about installing Fabric Loader can be found [here](https://fabricmc.net/use/). -To use Fabric API, download it from [CurseForge](https://www.curseforge.com/minecraft/mc-mods/fabric-api) or [GitHub Releases](https://github.com/FabricMC/fabric/releases). +To use Fabric API, download it from [CurseForge](https://www.curseforge.com/minecraft/mc-mods/fabric-api), [GitHub Releases](https://github.com/FabricMC/fabric/releases) or [Modrinth](https://modrinth.com/mod/fabric-api). The downloaded jar file should be placed in your `mods` folder. diff --git a/build.gradle b/build.gradle index 53616858e..2fbfe954f 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,7 @@ plugins { id "net.minecrell.licenser" version "0.4.1" id "org.ajoberstar.grgit" version "3.1.1" id "com.matthewprenger.cursegradle" version "1.4.0" + id "com.modrinth.minotaur" version "1.1.0" } def ENV = System.getenv() @@ -22,6 +23,7 @@ class Globals { static def mcVersion = "1.16.5" static def yarnVersion = "+build.1" static def loaderVersion = "0.10.5+build.213" + static def preRelease = false } version = Globals.baseVersion + "+" + (ENV.GITHUB_RUN_NUMBER ? "" : "local-") + getBranch() @@ -341,7 +343,7 @@ curseforge { project { id = "306612" changelog = "A changelog can be found at https://github.com/FabricMC/fabric/commits" - releaseType = "release" + releaseType = Globals.preRelease ? "beta" : "release" addGameVersion "1.16.5" addGameVersion "Fabric" @@ -375,12 +377,30 @@ task github(dependsOn: remapMavenJar) { releaseBuilder.name("[$Globals.mcVersion] Fabric API $Globals.baseVersion") releaseBuilder.body("A changelog can be found at https://github.com/FabricMC/fabric/commits") releaseBuilder.commitish(getBranch()) + releaseBuilder.prerelease(Globals.preRelease) def ghRelease = releaseBuilder.create() ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"), "application/java-archive"); } } +task modrinth(type: com.modrinth.minotaur.TaskModrinthUpload, dependsOn: remapMavenJar) { + onlyIf { + ENV.MODRINTH_TOKEN + } + + token = ENV.MODRINTH_TOKEN + projectId = "P7dR8mSH" + versionNumber = version + versionName = "[$Globals.mcVersion] Fabric API $Globals.baseVersion" + releaseType = Globals.preRelease ? "beta" : "release" + + uploadFile = file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar") + + addGameVersion(Globals.mcVersion) + addLoader('fabric') +} + // A task to ensure that the version being released has not already been released. task checkVersion { doFirst { @@ -394,5 +414,6 @@ task checkVersion { } github.mustRunAfter checkVersion +modrinth.mustRunAfter checkVersion publish.mustRunAfter checkVersion project.tasks.curseforge.mustRunAfter checkVersion