generated from QuiltMC/quilt-template-mod
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
110 lines (89 loc) · 3.23 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import me.modmuss50.mpp.ReleaseType
import net.fabricmc.loom.task.RemapJarTask
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
plugins {
id("kit_tunes.java.17")
id("kit_tunes.module")
id("kit_tunes.default_resources")
alias(libs.plugins.mod.publish.plugin)
}
mod {
dependencies {
required("quilt_loader").versionAbove(libs.versions.quilt.loader.get())
required("kitten_heart")
}
}
dependencies {
mappings(loom.officialMojangMappings())
include(project(":projects:kit-tunes-api"))
include(project(":projects:kitten-heart"))
include(project(":projects:catculator"))
include(project(":projects:kitten-sounds:b1.7.3"))
include(project(":projects:kitten-sounds:r1.17.0"))
include(project(":projects:kitten-sounds:r1.20.3"))
include(project(":projects:kitten-square:b1.7.3"))
include(project(":projects:kitten-square:r1.17.0"))
include(project(":projects:kitten-square:r1.19.0"))
include(project(":projects:kitten-square:r1.19.3"))
include(project(":projects:kitten-square:r1.19.4"))
include(project(":projects:kitten-square:r1.20.0"))
include(project(":projects:kitten-square:r1.20.3"))
include(project(":projects:kitten-square:r1.21.0"))
include(project(":projects:kitten-square:r1.21.2"))
}
tasks.withType<Jar> {
from("LICENSE")
}
val modVersion = project.property("mod_version").toString()
val publishVersions = project.property("publish_versions").toString()
val updateTitle = project.property("update_title").toString().uppercaseFirstChar()
fun getVersionType(): ReleaseType {
return if (modVersion.startsWith("0.") || modVersion.contains("-alpha.")) {
ReleaseType.ALPHA;
} else if (modVersion.contains("-")) {
ReleaseType.BETA;
} else {
ReleaseType.STABLE;
}
}
fun isSnapshotVersion(version: String): Boolean {
return if (version.startsWith("a") || version.startsWith("b")) {
true // Alpha and Beta versions
} else if (version.contains("-") || version.contains("w")) {
true // Pre-releases, Release Candidates, Snapshots, etc. ...
} else {
false
}
}
publishMods {
version = modVersion
displayName = "Kit Tunes $updateTitle $modVersion"
type = getVersionType()
modLoaders.add("quilt")
file = tasks.withType<RemapJarTask>()["remapJar"].archiveFile
changelog = file(rootDir.toPath().resolve("src/main/resources/changelog/${modVersion}.txt")).readText()
github {
accessToken = providers.environmentVariable("GITHUB_SECRET")
commitish = "meow"
tagName = "v${modVersion}"
repository = "Pixaurora/Kit-Tunes"
}
modrinth {
accessToken = providers.environmentVariable("MODRINTH_SECRET")
projectId = "AVOKl7hB"
publishVersions.split(",").forEach {
val parts = it.split("-")
if (parts.size != 2) {
throw RuntimeException("Invalid version range ${it}.")
}
val a = parts[0]
val b = parts[1]
minecraftVersionRange {
start = a
end = b
includeSnapshots = isSnapshotVersion(a) || isSnapshotVersion(b)
}
}
optional("fabric-api", "qsl", "modmenu")
}
}