From b3b1cbec53015fe4785a1b388c19cf842c46e392 Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+rainbowdashlabs@users.noreply.github.com> Date: Fri, 22 Mar 2024 12:56:14 +0100 Subject: [PATCH] Add modrinth publishing (#2) --- .github/workflows/publish_to_modrinth.yml | 36 +++++++++++++++++++++++ build.gradle.kts | 16 ++++++++++ settings.gradle.kts | 1 + 3 files changed, 53 insertions(+) create mode 100644 .github/workflows/publish_to_modrinth.yml diff --git a/.github/workflows/publish_to_modrinth.yml b/.github/workflows/publish_to_modrinth.yml new file mode 100644 index 0000000..2c04f83 --- /dev/null +++ b/.github/workflows/publish_to_modrinth.yml @@ -0,0 +1,36 @@ +name: Publish to Modrinth + +on: + push: + branches: + - main + +jobs: + build: + environment: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + - name: Build with Gradle + run: ./gradlew --build-cache build + - name: Test with Gradle + run: ./gradlew test + - name: Publish release to Modrinth + if: github.ref_name == 'main' + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + MODRINTH_CHANNEL: release + run: ./gradlew modrinth + - name: Publish dev to Modrinth + if: github.ref_name == 'dev' + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + MODRINTH_CHANNEL: development + run: ./gradlew modrinth diff --git a/build.gradle.kts b/build.gradle.kts index 8a0d779..0b85dea 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("xyz.jpenilla.run-paper") version "2.2.3" alias(libs.plugins.spotless) alias(libs.plugins.hangar) + alias(libs.plugins.modrinth) alias(libs.plugins.pluginyml) alias(libs.plugins.publishdata) `maven-publish` @@ -111,7 +112,22 @@ hangarPublish { } } } + + } +} + +modrinth { + token.set(System.getenv("MODRINTH_TOKEN")) + projectId.set("QeTYqlgP") + versionNumber.set(publishData.getVersion()) + versionType.set(System.getenv("MODRINTH_CHANNEL")) + uploadFile.set(tasks.jar) + gameVersions.addAll(listOf("1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20.4")) + loaders.addAll(listOf("paper", "spigot")) + dependencies { + required.project("FastAsyncWorldEdit") } + syncBodyFrom = rootProject.file("README.md").reader().readText() } bukkit { diff --git a/settings.gradle.kts b/settings.gradle.kts index b67f1d2..0faa2a7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -30,6 +30,7 @@ dependencyResolutionManagement { plugin("publishdata", "de.chojo.publishdata").version("1.4.0") plugin("pluginyml", "net.minecrell.plugin-yml.bukkit").version("0.6.0") plugin("hangar", "io.papermc.hangar-publish-plugin").version("0.1.2") + plugin("modrinth", "com.modrinth.minotaur").version("2.8.7") plugin("runserver", "xyz.jpenilla.run-paper").version("2.2.3") } }