CrazyAuctions/build.gradle.kts
2023-04-01 11:19:31 -04:00

68 lines
2.1 KiB
Plaintext

import com.lordcodes.turtle.shellRun
import task.WebhookExtension
import java.awt.Color
plugins {
id("crazyauctions.root-plugin")
}
val releaseUpdate = Color(27, 217, 106)
val betaUpdate = Color(255, 163, 71)
val changeLogs = Color(37, 137, 204)
val beta = settings.versions.beta.get().toBoolean()
val extension = settings.versions.extension.get()
val color = if (beta) betaUpdate else releaseUpdate
val repo = if (beta) "beta" else "releases"
val url = if (beta) "https://ci.crazycrew.us/job/${rootProject.name}/" else "https://modrinth.com/$extension/${rootProject.name.lowercase()}/versions"
val download = if (beta) "https://ci.crazycrew.us/job/${rootProject.name}/" else "https://modrinth.com/$extension/${rootProject.name.lowercase()}/version/${rootProject.version}"
val msg = if (beta) "New version of ${rootProject.name} is ready!" else "New version of ${rootProject.name} is ready! <@&929463441159254066>"
val hash = shellRun("git", listOf("rev-parse", "--short", "HEAD"))
rootProject.version = if (beta) hash else "1.11.14.3"
webhook {
this.avatar("https://en.gravatar.com/avatar/${WebhookExtension.Gravatar().md5Hex("no-reply@ryderbelserion.com")}.jpeg")
this.username("Ryder Belserion")
this.content(msg)
this.embeds {
this.embed {
this.color(color)
this.fields {
this.field(
"Download: ",
url
)
this.field(
"API: ",
"https://repo.crazycrew.us/#/$repo/${rootProject.group.toString().replace(".", "/")}/${rootProject.name.lowercase()}-api/${rootProject.version}"
)
}
this.author(
"${rootProject.name} | Version ${rootProject.version}",
url,
"https://git.crazycrew.us/ryderbelserion/assets/raw/branch/main/crazycrew/png/${rootProject.name}Website.png"
)
}
this.embed {
this.color(changeLogs)
this.title("What changed?")
this.description("""
Changes:
» N/A
""".trimIndent())
}
}
}