Skip to content

Commit

Permalink
added modrinth publishing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NonSwag committed Jul 2, 2024
1 parent c11a3bf commit f487cb4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/modrinth-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Modrinth Publish

on:
release:
types:
- prereleased
- released

jobs:
build:
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Publish with Gradle to Modrinth
uses: gradle/actions/setup-gradle@v3
with:
arguments: modrinth
16 changes: 15 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ plugins {
id("io.papermc.hangar-publish-plugin") version "0.1.2"
id("net.minecrell.plugin-yml.paper") version "0.6.0"
id("xyz.jpenilla.run-paper") version "2.1.0"
id("com.modrinth.minotaur") version "2.+"
}

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

val versions: List<String> = (property("gameVersions") as String)
.split(",")
.map { it.trim() }

hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing
publications.register("plugin") {
id.set("goPaintAdvanced")
Expand All @@ -92,7 +97,7 @@ hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing
apiKey.set(System.getenv("HANGAR_API_TOKEN"))
platforms.register(Platforms.PAPER) {
jar.set(tasks.shadowJar.flatMap { it.archiveFile })
platformVersions.set(listOf("1.20.6"))
platformVersions.set(versions)
dependencies {
url("FastAsyncWorldEdit", "https://hangar.papermc.io/IntellectualSites/FastAsyncWorldEdit") {
required.set(true)
Expand All @@ -101,3 +106,12 @@ hangarPublish { // docs - https://docs.papermc.io/misc/hangar-publishing
}
}
}

modrinth {
token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set("gBIw3Gvy")
versionType = if (isRelease) "release" else "beta"
uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile })
gameVersions.set(versions)
loaders.add("paper")
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gameVersions=1.20.6

0 comments on commit f487cb4

Please sign in to comment.