forked from KosmX/emotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
140 lines (117 loc) · 4.59 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
140 lines (117 loc) · 4.59 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
import org.redlance.dima_dencep.gradle.publish2discord.publishDiscord
import org.redlance.dima_dencep.gradle.publish2discord.utils.Emoji
import me.modmuss50.mpp.ReleaseType
plugins {
id("xyz.wagyourtail.jvmdowngrader") version("1.3.6") apply false
id("xyz.wagyourtail.unimined") version "1.4.2-SNAPSHOT" apply false
id("com.gradleup.shadow") version "9.6.1" apply false
id("me.modmuss50.mod-publish-plugin") version "2.2.0"
id("org.redlance.dima_dencep.gradle.PublishToDiscord") version "1.0.8"
}
allprojects {
apply(plugin = "java")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
group = "io.github.kosmx.emotes"
repositories {
maven("https://api.modrinth.com/maven") {
name = "Modrinth"
content {
includeGroup("maven.modrinth")
}
}
maven("https://maven.terraformersmc.com/") {
name = "TerraformersMC maven"
}
maven("https://maven.blamejared.com") {
name = "BlameJared Maven"
}
maven("https://repo.redlance.org/public")
maven("https://libraries.minecraft.net") {
content { // Fix issue with lwjgl-freetype not being found on macOS
includeModule("org.lwjgl", "lwjgl-freetype")
}
}
maven("https://repo.opencollab.dev/main/") {
name = "Geyser"
}
mavenLocal()
}
tasks.withType(JavaCompile::class).configureEach {
options.release = project.java_version.majorVersion.toInt()
options.encoding = "UTF-8"
}
repositories {
mavenCentral()
}
extensions.configure<JavaPluginExtension> {
withSourcesJar()
}
}
// ---------------- Publishing ----------------
releaseType = ENV["RELEASE_TYPE"] ?: "alpha"
changes = ENV["CHANGELOG"]?.replace("\\n", "\n") ?: ""
mod_version = project["version_base"]
if (releaseType != "stable") {
mod_version = "${project["version_base"]}-${releaseType[0]}.${ENV["BUILD_NUMBER"]?.let { "build.$it" } ?: getGitShortRevision()}"
}
version = mod_version
subprojects {
version = mod_version
}
shouldPublishMaven = providers.environmentVariable("KOSMX_TOKEN").getOrElse("").isNotBlank()
&& !gradle.startParameter.isDryRun
publishMods {
changelog = changes
type = ReleaseType.of(releaseType)
dryRun = gradle.startParameter.isDryRun
github {
tagName = mod_version
commitish = getGitRevision()
repository = providers.environmentVariable("GITHUB_REPOSITORY").orElse("KosmX/emotes")
accessToken = providers.environmentVariable("GH_TOKEN")
displayName = "Emotecraft-${mod_version}"
allowEmptyFiles = true
}
}
val ds = publishDiscord {
onlyIf {
val enabled = providers.environmentVariable("SEND_DISCORD")
.map(String::toBoolean).getOrElse(true)
if (!enabled) return@onlyIf false
val explicit = gradle.startParameter.taskNames.contains(name)
if (explicit) return@onlyIf true
val mods = gradle.taskGraph.allTasks.filter { it.name == "publishMods" }
mods.isNotEmpty() && mods.all { it.state.failure == null}
}
username = "Emotecraft Updates"
url = providers.environmentVariable("DISCORD_WEBHOOK")
container {
color = kotlin.random.Random.nextInt(0x000000, 0x1000000)
title = "## ✨ Emotecraft for Minecraft ${release_minecraft_versions.joinToString(", ")}\n### v$mod_version is out!"
description = "### Changes:\n${changes.replace("<br>", "\n- ")}"
thumbnail("https://raw.githubusercontent.com/KosmX/emotes/d97b2df4ab59bbd2740f30497e96f92cb643b2df/emotesAssets/src/main/resources/emotecraft_mod_logo.png")
timestamp(System.currentTimeMillis())
}
links {
// Fabric/NeoForge
from(":minecraft", "modrinth", title = "Fabric/NeoForge (Modrinth)")
from(":minecraft", "curseforgeFabric", title = "Fabric/Neoforge (CurseForge)")
nextRow()
// Paper
val paper = project(":paper")
from(paper, "modrinth", title = "Paper (Modrinth)")
val hangarProjectName = providers.gradleProperty("hangarProjectName").getOrElse("dima_dencep/emotecraft")
val hangarLink = "https://hangar.papermc.io/$hangarProjectName/versions/${paper.mod_version}"
custom("Paper (Hangar)", hangarLink, Emoji.HANGAR_EMOJI)
nextRow()
// Geyser
from(":geyser", "modrinth", title = "Geyser (Modrinth)")
}
footer = "||<@&926902263941849118>||"
}
allprojects {
tasks.matching { it.name == "publishMods" }.configureEach {
finalizedBy(ds)
}
}