@@ -5,6 +5,7 @@ plugins {
55 id(" net.fabricmc.fabric-loom-remap" ) version " 1.14-SNAPSHOT"
66 id(" org.jetbrains.kotlin.jvm" ) version " 2.3.0"
77 id(" dev.deftu.gradle.bloom" ) version " 0.2.0"
8+ id(" me.modmuss50.mod-publish-plugin" ) version " 1.1.0"
89}
910
1011val modid = property(" mod.id" )
@@ -13,9 +14,8 @@ val modversion = property("mod.version")
1314val mcversion = stonecutter.current.version
1415val oneconfigversion = property(" oneconfig_version" )
1516
16- base {
17- archivesName.set(property(" mod.id" ) as String )
18- }
17+ version = " $modversion +$mcversion "
18+ base.archivesName = modname.toString()
1919
2020repositories {
2121 maven(" https://maven.parchmentmc.org" )
@@ -97,4 +97,31 @@ tasks.jar {
9797}
9898
9999fun <T > optionalProp (property : String , block : (String ) -> T ? ): T ? =
100- findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let (block)
100+ findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let (block)
101+
102+ val modrinthId = findProperty(" publish.modrinth" )?.toString()?.takeIf { it.isNotBlank() }
103+
104+ // make sure modrinth.token is set in your user gradle properties
105+ publishMods {
106+ file = project.tasks.remapJar.get().archiveFile
107+
108+ displayName = modversion.toString()
109+ version = " v$modversion "
110+ changelog = project.rootProject.file(" CHANGELOG.md" ).takeIf { it.exists() }?.readText() ? : " No changelog provided."
111+ type = ALPHA
112+
113+ modLoaders.add(" fabric" )
114+
115+ dryRun = modrinthId == null
116+
117+ if (modrinthId != null ) {
118+ modrinth {
119+ projectId = property(" publish.modrinth" ).toString()
120+ accessToken = findProperty(" modrinth.token" ).toString()
121+
122+ minecraftVersions.add(mcversion)
123+
124+ requires(" oneconfig" )
125+ }
126+ }
127+ }
0 commit comments