Skip to content

Commit c3b2776

Browse files
committed
Publish using gradle plugin
1 parent f7f668b commit c3b2776

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

NeoForge/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import java.util.stream.Collectors
2-
31
plugins {
42
id 'ferritecore.loader-conventions'
53
id 'net.neoforged.moddev' version "$mdg_version"

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
plugins {
22
id 'net.neoforged.moddev' version "$mdg_version" apply false
33
id 'fabric-loom' version '1.5-SNAPSHOT' apply false
4+
id "me.modmuss50.mod-publish-plugin" version "0.7.4" apply false
45
}

buildSrc/src/main/groovy/ferritecore.loader-conventions.gradle

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id 'ferritecore.subproject-conventions'
3+
id "me.modmuss50.mod-publish-plugin"
34
}
45

56
String makeVersionSuffix() {
@@ -10,7 +11,8 @@ String makeVersionSuffix() {
1011
}
1112
}
1213

13-
archivesBaseName = "${mod_id}-${mod_version}${makeVersionSuffix()}-" + project.name.toLowerCase()
14+
def full_version = "${mod_version}${makeVersionSuffix()}";
15+
archivesBaseName = "${mod_id}-${full_version}-" + project.name.toLowerCase(Locale.ROOT)
1416

1517
jar {
1618
manifest {
@@ -30,14 +32,8 @@ jar {
3032
task signJar(description: "Sign jar") {
3133
doLast {
3234
if (project.hasProperty('keyStore')) {
33-
def path;
34-
if (project.name == "NeoForge") {
35-
path = jar.archivePath
36-
} else {
37-
path = remapJar.archivePath
38-
}
39-
logger.warn("Signing " + path + "\n")
40-
ant.signjar(jar: path,
35+
logger.warn("Signing " + jar.archivePath + "\n")
36+
ant.signjar(jar: jar.archivePath,
4137
alias: project.storeAlias,
4238
keystore: project.keyStore,
4339
storepass: project.storePass,
@@ -50,6 +46,7 @@ task signJar(description: "Sign jar") {
5046
}
5147

5248
build.finalizedBy signJar
49+
signJar.dependsOn build
5350

5451
compileJava.doFirst {
5552
// This is set by Mixin during annotation processing, but should not persist between subprobjects
@@ -97,3 +94,30 @@ tasks.withType(Task) {
9794
it.standardInput = System.in
9895
}
9996
}
97+
98+
def changelogFile = new File("changelog/${mod_version}.md");
99+
100+
if (changelogFile.exists()) {
101+
publishMods {
102+
file = jar.archivePath
103+
changelog = changelogFile.text
104+
type = STABLE
105+
modLoaders.add(name.toLowerCase(Locale.ROOT))
106+
displayName = archivesBaseName
107+
version = "${full_version}-${name.toLowerCase(Locale.ROOT)}"
108+
109+
curseforge {
110+
accessToken = providers.gradleProperty("CURSEFORGE_API_KEY").orElse("invalid-key-dry-run")
111+
projectId = project.name == "Fabric" ? "459857" : "429235"
112+
minecraftVersions.add(minecraft_version)
113+
}
114+
modrinth {
115+
accessToken = providers.gradleProperty("MODRINTH_API_KEY").orElse('invalid-key-dry-run')
116+
projectId = "uXXizFIs"
117+
minecraftVersions.add(minecraft_version)
118+
}
119+
}
120+
121+
tasks.getByName("publishCurseforge").dependsOn signJar
122+
tasks.getByName("publishModrinth").dependsOn signJar
123+
}

0 commit comments

Comments
 (0)