forked from Crazy-Crew/CrazyCrates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
142 lines (110 loc) · 4.48 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
142 lines (110 loc) · 4.48 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import utils.convertList
import utils.updateMarkdown
plugins {
id("modrinth-plugin")
id("hangar-plugin")
`java-plugin`
}
val git = feather.getGit()
allprojects {
apply(plugin = "java-library")
}
tasks {
withType<Jar> {
subprojects {
dependsOn(project.tasks.build)
}
// get subproject's built jars
val jars = subprojects.map { zipTree(it.tasks.jar.get().archiveFile.get().asFile) }
// merge them into main jar (except their manifests)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(jars) {
exclude("META-INF/MANIFEST.MF")
}
// put behind an action because files don't exist at configuration time
doFirst {
// merge all subproject's manifests into main manifest
jars.forEach { jar ->
jar.matching { include("META-INF/MANIFEST.MF") }
.files.forEach { file ->
manifest.from(file)
}
}
}
}
}
val releaseType = rootProject.ext.get("release_type").toString()
val color = rootProject.property("${releaseType.lowercase()}_color").toString()
val isRelease = releaseType.equals("release", true)
val isAlpha = releaseType.equals("alpha", true)
feather {
rootDirectory = rootProject.rootDir.toPath()
val data = git.getGithubCommit("${rootProject.property("repository_owner")}/${rootProject.name}")
val user = data.user
discord {
webhook {
group(rootProject.name.lowercase())
task("release-build")
if (System.getenv("BUILD_WEBHOOK") != null) {
post(System.getenv("BUILD_WEBHOOK"))
}
if (isRelease) {
username(user.getName())
avatar(user.avatar)
} else {
username(rootProject.property("author_name").toString())
avatar(rootProject.property("author_avatar").toString())
}
embeds {
embed {
color(color)
title("A new $releaseType version of ${rootProject.name} is ready!")
if (isRelease) {
content("<@&${rootProject.property("discord_role_id").toString()}>")
}
fields {
field(
"Version ${rootProject.version}",
listOf(
"*Click below to download!*",
"<:modrinth:1115307870473420800> [Modrinth](https://modrinth.com/plugin/${rootProject.name.lowercase()}/version/${rootProject.version})",
"<:hangar:1139326635313733652> [Hangar](https://hangar.papermc.io/${rootProject.property("repository_owner").toString().replace("-", "")}/${rootProject.name.lowercase()}/versions/${rootProject.version})"
).convertList()
)
field(
":bug: Report Bugs",
"https://github.com/${rootProject.property("repository_owner")}/${rootProject.name}/issues"
)
field(
":hammer: Changelog",
rootProject.ext.get("mc_changelog").toString().updateMarkdown()
)
}
}
}
}
webhook {
group(rootProject.name.lowercase())
task("failed-build")
if (System.getenv("BUILD_WEBHOOK") != null) {
post(System.getenv("BUILD_WEBHOOK"))
}
username(rootProject.property("mascot_name").toString())
avatar(rootProject.property("mascot_avatar").toString())
embeds {
embed {
color(rootProject.property("failed_color").toString())
title("Oh no! It failed!")
thumbnail("https://raw.githubusercontent.com/ryderbelserion/Branding/refs/heads/main/booze.jpg")
fields {
field(
"The build versioned ${rootProject.version} for project ${rootProject.name} failed.",
"The developer is likely already aware, he is just getting drunk.",
inline = true
)
}
}
}
}
}
}