Skip to content

Commit

Permalink
build(Publication): init hangar
Browse files Browse the repository at this point in the history
  • Loading branch information
rxchard committed Aug 13, 2024
1 parent 3e384e3 commit 280d906
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Publication/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import io.papermc.hangarpublishplugin.model.Platforms

plugins {
id("io.papermc.hangar-publish-plugin") version "0.1.2"
}

evaluationDependsOn(":Plugin")

// Waiting for https://docs.gradle.org/current/userguide/declaring_dependencies.html#sec:type-safe-project-accessors
var plugin = project(":Plugin")
// com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar ext org.gradle.api.tasks.bundling.Jar
var shadowJar = plugin.tasks.named<Jar>("shadowJar")

hangarPublish {
publications.register("plugin") {
apiKey.set(System.getenv("HANGAR_API_TOKEN"))
id.set(System.getenv("HANGAR_ID"))
channel.set(System.getenv("HANGAR_PUB_CHANNEL"))
changelog.set(System.getenv("HANGAR_PUB_CHANGELOG"))
version.set(plugin.version as String)
platforms {
register(Platforms.PAPER) {
jar.set(shadowJar.flatMap { it.archiveFile })
platformVersions.set(listOf(System.getenv("HANGAR_PLATFORM_VERSIONS")))
}
}
}
}

// Install depend for publish*ToHangar
tasks.matching { it.name.startsWith("publish") }.all { dependsOn(shadowJar) }
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ rootProject.name = "silkspawners"
include(
"API",
"Plugin",
"Publication",
"v1_8_4",
"v1_9_4",
"v1_12_0",
Expand Down

0 comments on commit 280d906

Please sign in to comment.