Add unified publishing for NeoForge

This commit is contained in:
Martin Prokoph
2024-06-08 20:35:30 +02:00
parent 5cae2a071d
commit aeeed9922a

View File

@@ -1,5 +1,6 @@
plugins { plugins {
id 'com.github.johnrengelman.shadow' id 'com.github.johnrengelman.shadow'
id "me.shedaniel.unified-publishing"
} }
repositories { repositories {
@@ -72,16 +73,32 @@ components.java {
} }
} }
publishing { unifiedPublishing {
publications { project {
mavenForge(MavenPublication) { displayName = "MidnightLib v$project.version - NeoForge $project.minecraft_version"
artifactId = rootProject.archives_base_name + "-" + project.name releaseType = "$project.release_type"
from components.java changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["neoforge"]
mainPublication remapJar
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version
} }
} }
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
repositories { if (MODRINTH_TOKEN != null) {
// Add repositories to publish to here. modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
} }
} }