-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
87 lines (73 loc) · 2.65 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
import pl.allegro.tech.build.axion.release.domain.hooks.HookContext
import java.time.OffsetDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
plugins {
kotlin("jvm") version "1.8.10"
id("maven-publish")
id("pl.allegro.tech.build.axion-release") version "1.14.4"
id("org.jlleitschuh.gradle.ktlint") version "11.2.0"
}
val repoRef = "dotRun\\/MCVotifierLib"
group = "io.dotrun"
version = scmVersion.version
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
scmVersion {
versionIncrementer("incrementMinorIfNotOnRelease", mapOf("releaseBranchPattern" to "release/.+"))
hooks {
// FIXME - workaround for Kotlin DSL issue https://github.com/allegro/axion-release-plugin/issues/500
pre(
"fileUpdate",
mapOf(
"file" to "CHANGELOG.md",
"pattern" to KotlinClosure2<String, HookContext, String>({ _, _ ->
"\\[Unreleased\\]([\\s\\S]+?)\\n(?:^\\[Unreleased\\]: https:\\/\\/github\\.com\\/$repoRef\\/compare\\/[^\\n]*\$([\\s\\S]*))?\\z"
}),
"replacement" to KotlinClosure2<String, HookContext, String>({ v, c ->
"""
\[Unreleased\]
## \[$v\] - ${currentDateString()}$1
\[Unreleased\]: https:\/\/github\.com\/$repoRef\/compare\/v$v...HEAD
\[$v\]: https:\/\/github\.com\/$repoRef\/${if (c.previousVersion == v) "releases/tag/v$v" else "compare/v${c.previousVersion}...v$v"}${'$'}2
""".trimIndent()
})
)
)
pre("commit")
}
}
fun currentDateString() = OffsetDateTime.now(ZoneOffset.UTC).toLocalDate().format(DateTimeFormatter.ISO_DATE)
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin", version = "2.14.2")
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/dotRun/MCVotifierLib")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
register<MavenPublication>("gpr") {
from(components["java"])
}
}
}
tasks {
wrapper {
gradleVersion = "8.0.1"
distributionType = Wrapper.DistributionType.ALL
}
}