Skip to content

Commit f487cb4

Browse files
author
david
committed
added modrinth publishing workflow
1 parent c11a3bf commit f487cb4

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Modrinth Publish
2+
3+
on:
4+
release:
5+
types:
6+
- prereleased
7+
- released
8+
9+
jobs:
10+
build:
11+
env:
12+
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '21'
20+
distribution: 'temurin'
21+
- name: Publish with Gradle to Modrinth
22+
uses: gradle/actions/setup-gradle@v3
23+
with:
24+
arguments: modrinth

build.gradle.kts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ plugins {
1010
id("io.papermc.hangar-publish-plugin") version "0.1.2"
1111
id("net.minecrell.plugin-yml.paper") version "0.6.0"
1212
id("xyz.jpenilla.run-paper") version "2.1.0"
13+
id("com.modrinth.minotaur") version "2.+"
1314
}
1415

1516
group = "net.thenextlvl.gopaint"
@@ -84,6 +85,10 @@ tasks.runServer {
8485
val versionString: String = project.version as String
8586
val isRelease: Boolean = !versionString.contains("-pre")
8687

88+
val versions: List<String> = (property("gameVersions") as String)
89+
.split(",")
90+
.map { it.trim() }
91+
8792
hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing
8893
publications.register("plugin") {
8994
id.set("goPaintAdvanced")
@@ -92,7 +97,7 @@ hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing
9297
apiKey.set(System.getenv("HANGAR_API_TOKEN"))
9398
platforms.register(Platforms.PAPER) {
9499
jar.set(tasks.shadowJar.flatMap { it.archiveFile })
95-
platformVersions.set(listOf("1.20.6"))
100+
platformVersions.set(versions)
96101
dependencies {
97102
url("FastAsyncWorldEdit", "https://hangar.papermc.io/IntellectualSites/FastAsyncWorldEdit") {
98103
required.set(true)
@@ -101,3 +106,12 @@ hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing
101106
}
102107
}
103108
}
109+
110+
modrinth {
111+
token.set(System.getenv("MODRINTH_TOKEN"))
112+
projectId.set("gBIw3Gvy")
113+
versionType = if (isRelease) "release" else "beta"
114+
uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile })
115+
gameVersions.set(versions)
116+
loaders.add("paper")
117+
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gameVersions=1.20.6

0 commit comments

Comments
 (0)