-
-
Notifications
You must be signed in to change notification settings - Fork 246
/
build.gradle.kts
189 lines (175 loc) · 5.73 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jreleaser.model.Active
import org.jreleaser.model.Distribution.DistributionType.SINGLE_JAR
import org.jreleaser.model.api.common.Apply
import kotlin.io.path.Path
import kotlin.io.path.exists
plugins {
run {
val kotlinVersion = "1.9.21"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
kotlin("kapt") version kotlinVersion
}
id("org.jlleitschuh.gradle.ktlint") version "12.1.0"
id("com.github.ben-manes.versions") version "0.50.0"
id("org.jreleaser") version "1.10.0"
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val unstableKeyword = listOf("ALPHA", "RC").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return unstableKeyword || !isStable
}
group = "org.gotson"
allprojects {
repositories {
mavenCentral()
}
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "com.github.ben-manes.versions")
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
// disallow release candidates as upgradable versions from stable versions
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
gradleReleaseChannel = "current"
checkConstraints = true
}
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
version = "1.1.1"
}
}
tasks.wrapper {
gradleVersion = "8.5"
distributionType = Wrapper.DistributionType.ALL
}
jreleaser {
project {
description = "Media server for comics/mangas/BDs with API and OPDS support"
copyright = "Gauthier Roebroeck"
authors.add("Gauthier Roebroeck")
license = "MIT"
links {
homepage = "https://komga.org"
}
}
release {
github {
discussionCategoryName = "Announcements"
skipTag = true
tagName = "{{projectVersion}}"
changelog {
formatted = Active.ALWAYS
preset = "conventional-commits"
skipMergeCommits = true
links = true
content = (if (Path("./release_notes/release_notes.md").exists()) "{{#f_file_read}}{{basedir}}/release_notes/release_notes.md{{/f_file_read}}" else "") +
"""
## Changelog
{{changelogChanges}}
{{changelogContributors}}
""".trimIndent()
format = "- {{#commitIsConventional}}{{#conventionalCommitIsBreakingChange}}🚨 {{/conventionalCommitIsBreakingChange}}{{#conventionalCommitScope}}**{{conventionalCommitScope}}**: {{/conventionalCommitScope}}{{conventionalCommitDescription}}{{#conventionalCommitBreakingChangeContent}}: *{{conventionalCommitBreakingChangeContent}}*{{/conventionalCommitBreakingChangeContent}} ({{commitShortHash}}){{/commitIsConventional}}{{^commitIsConventional}}{{commitTitle}} ({{commitShortHash}}){{/commitIsConventional}}{{#commitHasIssues}}, closes{{#commitIssues}} {{issue}}{{/commitIssues}}{{/commitHasIssues}}"
hide {
uncategorized = true
contributors = listOf("Weblate", "GitHub", "semantic-release-bot", "[bot]", "github-actions")
}
excludeLabels.add("chore")
category {
title = "🏎 Perf"
key = "perf"
labels.add("perf")
order = 25
}
category {
title = "🌐 Translation"
key = "i18n"
labels.add("i18n")
order = 70
}
category {
title = "⚙️ Dependencies"
key = "dependencies"
labels.add("dependencies")
order = 80
}
labeler {
label = "perf"
title = "regex:^(?:perf(?:\\(.*\\))?!?):\\s.*"
order = 120
}
labeler {
label = "i18n"
title = "regex:^(?:i18n(?:\\(.*\\))?!?):\\s.*"
order = 130
}
labeler {
label = "dependencies"
title = "regex:^(?:deps(?:\\(.*\\))?!?):\\s.*"
order = 140
}
extraProperties.put("categorizeScopes", true)
append {
enabled = true
title = "# [{{projectVersion}}]({{repoUrl}}/compare/{{previousTagName}}...{{tagName}}) ({{#f_now}}YYYY-MM-dd{{/f_now}})"
target = rootDir.resolve("CHANGELOG.md")
content =
"""
{{changelogTitle}}
{{changelogChanges}}
""".trimIndent()
}
}
issues {
enabled = true
comment = "🎉 This issue has been resolved in `{{tagName}}` ([Release Notes]({{releaseNotesUrl}}))"
applyMilestone = Apply.ALWAYS
label {
name = "released"
description = "Issue has been released"
color = "#ededed"
}
}
}
}
distributions {
create("komga") {
active = Active.RELEASE
distributionType = SINGLE_JAR
artifact {
path = rootDir.resolve("komga/build/libs/komga-{{projectVersion}}.jar")
}
}
}
packagers {
docker {
active = Active.RELEASE
continueOnError = true
templateDirectory = rootDir.resolve("komga/docker")
repository.active = Active.NEVER
buildArgs = listOf("--cache-from", "gotson/komga:latest")
imageNames =
listOf(
"komga:latest",
"komga:{{projectVersion}}",
"komga:{{projectVersionMajor}}.x",
)
registries {
create("docker.io") { externalLogin = true }
create("ghcr.io") { externalLogin = true }
}
buildx {
enabled = true
createBuilder = false
platforms =
listOf(
"linux/amd64",
"linux/arm/v7",
"linux/arm64/v8",
)
}
}
}
}