@@ -20,6 +20,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
20
20
import dev.architectury.plugin.ArchitectPluginExtension
21
21
import groovy.json.JsonOutput
22
22
import groovy.json.JsonSlurper
23
+ import me.modmuss50.mpp.ModPublishExtension
23
24
import net.fabricmc.loom.api.LoomGradleExtensionAPI
24
25
import net.fabricmc.loom.task.RemapJarTask
25
26
import org.objectweb.asm.ClassReader
@@ -32,6 +33,8 @@ import java.util.jar.JarEntry
32
33
import java.util.jar.JarFile
33
34
import java.util.jar.JarOutputStream
34
35
import java.util.zip.Deflater
36
+ import dev.ithundxr.silk.ChangelogText
37
+ import me.modmuss50.mpp.ReleaseType
35
38
36
39
plugins {
37
40
java
@@ -163,7 +166,7 @@ subprojects {
163
166
platformSetupLoomIde()
164
167
}
165
168
166
- tasks.named<RemapJarTask >(" remapJar" ) {
169
+ val remapJar = tasks.named<RemapJarTask >(" remapJar" ) {
167
170
from(" ${rootProject.projectDir} /LICENSE" )
168
171
val shadowJar = project.tasks.named<ShadowJar >(" shadowJar" ).get()
169
172
inputFile.set(shadowJar.archiveFile)
@@ -248,6 +251,51 @@ subprojects {
248
251
skip()
249
252
}
250
253
}
254
+
255
+ val isFabric = project.name == " fabric"
256
+ val releaseType =
257
+ if (version.toString().contains(" alpha" )) {
258
+ ReleaseType .ALPHA ;
259
+ } else if (version.toString().contains(" beta" )) {
260
+ ReleaseType .BETA ;
261
+ } else {
262
+ ReleaseType .STABLE ;
263
+ }
264
+ configure<ModPublishExtension > {
265
+ file.set(remapJar.get().archiveFile)
266
+ version.set(project.version.toString())
267
+ changelog = ChangelogText .getChangelogText(rootProject).toString()
268
+ type = releaseType
269
+ displayName = " Steam 'n' Rails ${" mod_version" ()} $capitalizedName ${" minecraft_version" ()} "
270
+ if (isFabric) {
271
+ modLoaders.add(" fabric" )
272
+ modLoaders.add(" quilt" )
273
+ } else {
274
+ modLoaders.add(" forge" )
275
+ modLoaders.add(" neoforge" )
276
+ }
277
+
278
+ val createVersionType = if (project.name == " fabric" ) " create-fabric" else " create"
279
+ curseforge {
280
+ projectId = " curseforge_id" ()
281
+ accessToken = providers.environmentVariable(" CURSEFORGE_TOKEN" )
282
+ minecraftVersions.add(" minecraft_version" ())
283
+
284
+ requires {
285
+ slug = createVersionType
286
+ }
287
+ }
288
+
289
+ modrinth {
290
+ projectId = " modrinth_id" ()
291
+ accessToken = providers.environmentVariable(" MODRINTH_TOKEN" )
292
+ minecraftVersions.add(" minecraft_version" ())
293
+
294
+ requires {
295
+ slug = createVersionType
296
+ }
297
+ }
298
+ }
251
299
}
252
300
253
301
fun transformJar (jar : File ) {
@@ -383,7 +431,7 @@ fun calculateGitHash(): String {
383
431
commandLine(" git" , " rev-parse" , " HEAD" )
384
432
}
385
433
return output.standardOutput.asText.get().trim()
386
- } catch (ignored : Throwable ) {
434
+ } catch (_ : Throwable ) {
387
435
return " unknown"
388
436
}
389
437
}
@@ -394,7 +442,7 @@ fun calculateGitBranch(): String {
394
442
commandLine(" git" , " rev-parse" , " --abbrev-ref" , " HEAD" )
395
443
}
396
444
return output.standardOutput.asText.get().trim()
397
- } catch (ignored : Throwable ) {
445
+ } catch (_ : Throwable ) {
398
446
return " unknown"
399
447
}
400
448
}
@@ -408,7 +456,7 @@ fun hasUnstaged(): Boolean {
408
456
if (result.isNotEmpty())
409
457
println (" Found stageable results:\n ${result} \n " )
410
458
return result.isNotEmpty()
411
- } catch (ignored : Throwable ) {
459
+ } catch (_ : Throwable ) {
412
460
return false
413
461
}
414
462
}
0 commit comments