From dccc01ef498a709f35f019d1e78c5ed96e53bd1a Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Sun, 3 Mar 2024 19:33:25 +0100 Subject: [PATCH] Added Modrinth Auto Publisher on github workflow --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ build.gradle | 22 ++++++++++++++++++++-- gradle.properties | 1 + 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7f4b154 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish mod on Modrinth + +on: [ push, workflow_dispatch ] + +env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout repository + uses: actions/checkout@v3 + - name: validate gradle wrapper + uses: https://github.com/gradle/wrapper-validation-action@v1 + - name: setup jdk + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'oracle' + - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} + run: | + chmod +x ./gradlew + touch local.properties + - name: Generate data + run: ./gradlew runDatagen + - name: Publish Modrinth + run: ./gradlew modrinth + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5f3cecb..5799aee 100755 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ import fr.altarik.CreateTag plugins { + id "com.modrinth.minotaur" version "2.+" id 'fabric-loom' version '1.5-SNAPSHOT' id 'maven-publish' } @@ -102,8 +103,8 @@ dependencies { // Indium and sodium for sodium support modCompileOnly "maven.modrinth:indium:${project.indium_version}+mc${project.minecraft_version}" modCompileOnly "maven.modrinth:sodium:mc${project.minecraft_version}-${project.sodium_version}" - modRuntimeOnly "maven.modrinth:indium:${project.indium_version}+mc${project.minecraft_version}" - modRuntimeOnly "maven.modrinth:sodium:mc${project.minecraft_version}-${project.sodium_version}" +// modRuntimeOnly "maven.modrinth:indium:${project.indium_version}+mc${project.minecraft_version}" +// modRuntimeOnly "maven.modrinth:sodium:mc${project.minecraft_version}-${project.sodium_version}" // Athena for connected texture modCompileOnly "earth.terrarium.athena:athena-fabric-${project.minecraft_version}:${project.athena_version}" @@ -190,6 +191,23 @@ publishing { } } +// configure modrinth publication +modrinth { + token = getEnv("MODRINTH_TOKEN", local.getProperty("modrinth_token")) + projectId = project.modrinth_id + versionNumber = project.mod_version + versionName = "${project.archives_base_name} ${project.mod_version}" + versionType = project.mod_version.endsWith('SNAPSHOT') ? 'beta' : 'release' + uploadFile = remapJar + gameVersions = [project.minecraft_version] + loaders = ["fabric"] + dependencies { + required.project "fabric-api" + optional.version "b1ZV3DIJ", "${project.athena_version}" + optional.version "Orvt0mRa", "${project.indium_version}+mc${project.minecraft_version}" + } +} + tasks.register("reportToDiscord", ReportDiscord) { config.set(reportConfig) } diff --git a/gradle.properties b/gradle.properties index f2dd625..23f23bf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,7 @@ yarn_mappings=1.20.4+build.3 loader_version=0.15.6 # Mod Properties +modrinth_id = jCpoCBpn mod_version = 1.3.1 maven_group = fr.adrien1106 archives_base_name = ReFramed