Skip to content

Commit ed0ea8a

Browse files
committed
Add unified publishing to build.gradle
1 parent 2fb734a commit ed0ea8a

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ libs
2525

2626
# Files from Forge MDK
2727
forge*changelog.txt
28+
29+
# Changelog for unified publishing
30+
CHANGELOG.md

build.gradle

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
id 'idea'
55
id 'maven-publish'
66
id 'net.neoforged.gradle.userdev' version '7.0.181'
7+
id "me.shedaniel.unified-publishing" version "0.1.+"
78
}
89

910
version = mod_version
@@ -223,6 +224,41 @@ tasks.withType(JavaCompile).configureEach {
223224
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
224225
}
225226

227+
tasks.publishUnified {
228+
dependsOn tasks.getByName("build")
229+
}
230+
231+
unifiedPublishing {
232+
project {
233+
displayName = "Energized Power - " + project.minecraft_version + " - v" + project.mod_version.split("-")[1] + " [NeoForge]"
234+
version = project.mod_version
235+
changelog = new File("CHANGELOG.md").getText("UTF-8")
236+
releaseType = "release"
237+
gameVersions = [project.minecraft_version]
238+
gameLoaders = ["neoforge"]
239+
240+
mainPublication.set(project.rootDir.toPath().resolve("build/libs").resolve(project.mod_id + "-" + project.version + ".jar").toFile())
241+
242+
relations {
243+
//No dependencies
244+
}
245+
246+
if(project.hasProperty('MODRINTH_TOKEN')) {
247+
modrinth {
248+
token = getProperty('MODRINTH_TOKEN') as String
249+
id = "6pku8gW1"
250+
}
251+
}
252+
253+
if(project.hasProperty('CURSEFORGE_TOKEN')) {
254+
curseforge {
255+
token = getProperty('CURSEFORGE_TOKEN') as String
256+
id = "782147"
257+
}
258+
}
259+
}
260+
}
261+
226262
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
227263
idea {
228264
module {

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ pluginManagement {
22
repositories {
33
gradlePluginPortal()
44
maven { url = 'https://maven.neoforged.net/releases' }
5+
maven { url "https://maven.architectury.dev/" }
56
}
67
}

0 commit comments

Comments
 (0)