Skip to content

Commit

Permalink
Add modrinth publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs committed Mar 22, 2024
1 parent eeb6a25 commit d7f3958
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/publish_to_modrinth.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down

0 comments on commit d7f3958

Please sign in to comment.