Skip to content

Commit 663dd67

Browse files
committed
update publishing and modstitch
1 parent bcce17f commit 663dd67

File tree

3 files changed

+95
-43
lines changed

3 files changed

+95
-43
lines changed

build.gradle.kts

Lines changed: 94 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1+
import java.time.LocalDateTime
2+
import java.time.format.DateTimeFormatter
3+
14
plugins {
2-
id("dev.isxander.modstitch.base") version "0.7.1-unstable"
3-
id("fabric-loom") version "1.13-SNAPSHOT" apply false
5+
id("dev.isxander.modstitch.base") version "0.8.4"
46
id("me.modmuss50.mod-publish-plugin") version "0.8.4"
7+
58
`maven-publish`
9+
signing
10+
id("dev.isxander.secrets") version "0.1.0"
611
id("org.ajoberstar.grgit") version "5.3.2"
12+
id("com.gradleup.nmcp.aggregation") version "1.4.3"
13+
id("com.gradleup.nmcp") version "1.4.3"
714
}
815

9-
val debugifyVersion = "1.1"
16+
val debugifyVersion = "1.0"
1017

1118
modstitch {
1219
minecraftVersion = "1.21.11"
13-
modLoaderVersion = "0.18.0"
20+
modLoaderVersion = "0.18.4"
1421

1522
parchment {
1623
mappingsVersion = "2025.12.20"
@@ -106,6 +113,8 @@ dependencies {
106113
"gametestImplementation"(sourceSets.main.get().output)
107114
"gametestImplementation"(sourceSets["client"].output)
108115
"modGametestImplementation"(fabricApi.module("fabric-gametest-api-v1", fabricApiVersion))
116+
117+
nmcpAggregation(project)
109118
}
110119

111120
java {
@@ -130,66 +139,109 @@ publishMods {
130139
?.let { if (header != null) "$header\n\n$it" else it }
131140
}
132141

133-
val modrinthId: String by project
134-
if (modrinthId.isNotBlank() && hasProperty("modrinth.token")) {
135-
modrinth {
136-
projectId.set(modrinthId)
137-
accessToken.set(findProperty("modrinth.token")?.toString())
138-
minecraftVersions.add(modstitch.minecraftVersion)
142+
modrinth {
143+
projectId = providers.gradleProperty("pub.modrinthId")
144+
accessToken = secrets.gradleProperty("modrinth.accessToken")
139145

140-
requires { slug.set("yacl") }
141-
requires { slug.set("fabric-api") }
142-
optional { slug.set("modmenu") }
143-
}
146+
minecraftVersions.add(modstitch.minecraftVersion)
147+
148+
requires { slug.set("yacl") }
149+
requires { slug.set("fabric-api") }
150+
optional { slug.set("modmenu") }
144151
}
145152

146-
val curseforgeId: String by project
147-
if (curseforgeId.isNotBlank() && hasProperty("curseforge.token")) {
148-
curseforge {
149-
projectId.set(curseforgeId)
150-
accessToken.set(findProperty("curseforge.token")?.toString())
151-
minecraftVersions.add(modstitch.minecraftVersion)
153+
curseforge {
154+
projectId = providers.gradleProperty("pub.curseforgeId")
155+
projectSlug = providers.gradleProperty("pub.curseforgeSlug")
156+
accessToken = secrets.gradleProperty("curseforge.accessToken")
152157

153-
requires { slug.set("yacl") }
154-
requires { slug.set("fabric-api") }
155-
optional { slug.set("modmenu") }
156-
}
158+
minecraftVersions.add(modstitch.minecraftVersion)
159+
160+
requires { slug.set("yacl") }
161+
requires { slug.set("fabric-api") }
162+
optional { slug.set("modmenu") }
157163
}
158164

159165
val githubProject: String by project
160166
if (githubProject.isNotBlank() && hasProperty("github.token")) {
161-
github {
162-
repository.set(githubProject)
163-
accessToken.set(findProperty("github.token")?.toString())
164-
commitish.set(grgit.branch.current().name)
165-
}
167+
168+
}
169+
github {
170+
repository = providers.gradleProperty("githubProject")
171+
accessToken = secrets.gradleProperty("github.accessToken")
172+
173+
commitish = grgit.branch.current().name
166174
}
167175
}
168176

169177
publishing {
170178
publications {
171-
create<MavenPublication>("debugify") {
179+
create<MavenPublication>("mod") {
180+
from(components["java"])
181+
172182
groupId = "dev.isxander"
173183
artifactId = "debugify"
174-
175-
from(components["java"])
184+
version = modstitch.metadata.modVersion.get()
185+
186+
pom {
187+
name = modstitch.metadata.modName
188+
description = modstitch.metadata.modDescription
189+
url = "https://www.isxander.dev/projects/debugify"
190+
licenses {
191+
license {
192+
name = "LGPL-3.0-or-later"
193+
url = "https://www.gnu.org/licenses/lgpl-3.0.en.html"
194+
}
195+
}
196+
developers {
197+
developer {
198+
id = "isXander"
199+
name = "Xander"
200+
201+
}
202+
}
203+
scm {
204+
url = "https://github.com/isXander/Debugify"
205+
connection = "scm:git:git//github.com/isXander/Debugify.git"
206+
developerConnection = "scm:git:ssh://[email protected]/isXander/Debugify.git"
207+
}
208+
}
176209
}
177210
}
211+
}
178212

179-
repositories {
180-
if (hasProperty("XANDER_MAVEN_USER") && hasProperty("XANDER_MAVEN_PASS")) {
181-
maven(url = "https://maven.isxander.dev/releases") {
182-
credentials {
183-
username = property("XANDER_MAVEN_USER")?.toString()
184-
password = property("XANDER_MAVEN_PASS")?.toString()
185-
}
213+
val signingKeyProvider = secrets.gradleProperty("signing.secretKey")
214+
val signingPasswordProvider = secrets.gradleProperty("signing.password")
215+
signing {
216+
sign(publishing.publications["mod"])
217+
}
218+
// not configuration cache friendly, but neither is the whole of signing plugin
219+
// this plugin does not support lazy configuration of signing keys
220+
gradle.taskGraph.whenReady {
221+
val willSign = allTasks.any { it.name.startsWith("sign") }
222+
if (willSign) {
223+
signing {
224+
val signingKey = signingKeyProvider.orNull
225+
val signingPassword = signingPasswordProvider.orNull
226+
227+
isRequired = signingKey != null && signingPassword != null
228+
if (isRequired) {
229+
useInMemoryPgpKeys(signingKey, signingPassword)
230+
} else {
231+
logger.error("Signing keys not found; skipping signing!")
186232
}
187-
} else {
188-
println("Xander Maven credentials not satisfied")
189233
}
190234
}
191235
}
192236

237+
nmcpAggregation {
238+
centralPortal {
239+
username = secrets.gradleProperty("mcentral.username")
240+
password = secrets.gradleProperty("mcentral.password")
241+
242+
publicationName = "debugify:$version"
243+
}
244+
}
193245

194246

195247
val generatePatchedTable by tasks.registering {
@@ -213,7 +265,7 @@ val generatePatchedTable by tasks.registering {
213265

214266
val previous = entries.filterIsInstance<PatchedFileEntry.Previous>()
215267

216-
val timestamp = `java.time`.LocalDateTime.now().format(`java.time.format`.DateTimeFormatter.ISO_DATE_TIME)
268+
val timestamp = LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)
217269

218270
val markdownTable = """
219271
- <!--

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4G
22
org.gradle.parallel=true
33
org.gradle.parallel.threads=4
44

5-
modstitch.platform=loom
5+
modstitch.platform=fabric-loom-remap
66

77
modrinthId=QwxR6Gcd
88
curseforgeId=596224
File renamed without changes.

0 commit comments

Comments
 (0)