Skip to content

Commit

Permalink
Merge pull request #5 from TheNextLvl-net/publishing
Browse files Browse the repository at this point in the history
added modrinth publishing
  • Loading branch information
NonSwag authored Jun 28, 2024
2 parents 24f6a5c + 5e6f64b commit 4e6e2bb
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ java {
}

group = "net.thenextlvl.worlds"
version = "1.2.2"
version = "1.2.3"

repositories {
mavenCentral()
Expand Down
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
16 changes: 15 additions & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id("io.papermc.hangar-publish-plugin") version "0.1.2"
id("net.minecrell.plugin-yml.paper") version "0.6.0"
id("io.github.goooler.shadow") version "8.1.7"
id("com.modrinth.minotaur") version "2.+"
}

java {
Expand Down Expand Up @@ -84,6 +85,10 @@ paper {
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("Worlds")
Expand All @@ -92,7 +97,16 @@ 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)
}
}
}

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")
}

0 comments on commit 4e6e2bb

Please sign in to comment.