komga/build.gradle.kts

190 lines
5.7 KiB
Plaintext
Raw Normal View History

import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
2023-08-14 16:28:03 +08:00
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
2021-01-08 16:19:25 +08:00
plugins {
2021-02-17 16:58:46 +08:00
run {
2024-01-22 16:08:14 +08:00
val kotlinVersion = "1.9.21"
2021-02-17 16:58:46 +08:00
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
kotlin("kapt") version kotlinVersion
}
2024-12-13 12:15:09 +08:00
id("org.jlleitschuh.gradle.ktlint") version "12.1.2"
id("com.github.ben-manes.versions") version "0.51.0"
2024-01-22 12:26:43 +08:00
id("org.jreleaser") version "1.10.0"
2021-01-08 16:19:25 +08:00
}
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
}
2023-08-14 16:28:03 +08:00
group = "org.gotson"
2021-01-08 16:27:21 +08:00
allprojects {
repositories {
mavenCentral()
}
2021-02-17 16:58:46 +08:00
apply(plugin = "org.jlleitschuh.gradle.ktlint")
2021-03-05 14:12:53 +08:00
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
}
2021-06-10 16:34:14 +08:00
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
2024-12-13 12:15:09 +08:00
version = "1.5.0"
2021-06-10 16:34:14 +08:00
}
2021-01-08 16:19:25 +08:00
}
2019-08-08 17:55:56 +08:00
tasks.wrapper {
2024-12-13 10:33:45 +08:00
gradleVersion = "8.11.1"
2019-08-08 17:55:56 +08:00
distributionType = Wrapper.DistributionType.ALL
2019-11-15 15:44:26 +08:00
}
2023-08-14 16:28:03 +08:00
jreleaser {
project {
description = "Media server for comics/mangas/BDs with API and OPDS support"
copyright = "Gauthier Roebroeck"
2023-08-14 16:28:03 +08:00
authors.add("Gauthier Roebroeck")
license = "MIT"
2023-08-14 16:28:03 +08:00
links {
homepage = "https://komga.org"
2023-08-14 16:28:03 +08:00
}
}
release {
github {
discussionCategoryName = "Announcements"
skipTag = true
tagName = "{{projectVersion}}"
2023-08-14 16:28:03 +08:00
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 "") +
"""
2024-01-22 15:26:37 +08:00
## Changelog
2024-01-22 15:26:37 +08:00
{{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}}"
2023-08-14 16:28:03 +08:00
hide {
uncategorized = true
contributors = listOf("Weblate", "GitHub", "semantic-release-bot", "[bot]", "github-actions")
2023-08-14 16:28:03 +08:00
}
excludeLabels.add("chore")
category {
title = "🏎 Perf"
key = "perf"
2023-08-14 16:28:03 +08:00
labels.add("perf")
order = 25
2023-08-14 16:28:03 +08:00
}
category {
title = "🌐 Translation"
key = "i18n"
2023-08-14 16:28:03 +08:00
labels.add("i18n")
order = 70
2023-08-14 16:28:03 +08:00
}
category {
title = "⚙️ Dependencies"
key = "dependencies"
labels.add("dependencies")
order = 80
}
2023-08-14 16:28:03 +08:00
labeler {
label = "perf"
title = "regex:^(?:perf(?:\\(.*\\))?!?):\\s.*"
order = 120
2023-08-14 16:28:03 +08:00
}
labeler {
label = "i18n"
title = "regex:^(?:i18n(?:\\(.*\\))?!?):\\s.*"
order = 130
2023-08-14 16:28:03 +08:00
}
labeler {
label = "dependencies"
title = "regex:^(?:deps(?:\\(.*\\))?!?):\\s.*"
order = 140
}
2023-08-14 16:28:03 +08:00
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")
2024-01-22 15:26:37 +08:00
content =
"""
2023-08-14 16:28:03 +08:00
{{changelogTitle}}
{{changelogChanges}}
2024-01-22 15:26:37 +08:00
""".trimIndent()
2023-08-14 16:28:03 +08:00
}
}
issues {
enabled = true
comment = "🎉 This issue has been resolved in `{{tagName}}` ([Release Notes]({{releaseNotesUrl}}))"
applyMilestone = Apply.ALWAYS
2023-08-14 16:28:03 +08:00
label {
name = "released"
description = "Issue has been released"
color = "#ededed"
2023-08-14 16:28:03 +08:00
}
}
}
}
distributions {
create("komga") {
active = Active.RELEASE
distributionType = SINGLE_JAR
2023-08-14 16:28:03 +08:00
artifact {
path = rootDir.resolve("komga/build/libs/komga-{{projectVersion}}.jar")
2023-08-14 16:28:03 +08:00
}
}
}
packagers {
docker {
active = Active.RELEASE
continueOnError = true
templateDirectory = rootDir.resolve("komga/docker")
repository.active = Active.NEVER
buildArgs = listOf("--cache-from", "gotson/komga:latest")
2024-01-22 15:26:37 +08:00
imageNames =
listOf(
"komga:latest",
"komga:{{projectVersion}}",
"komga:{{projectVersionMajor}}.x",
)
2023-08-14 16:28:03 +08:00
registries {
create("docker.io") { externalLogin = true }
create("ghcr.io") { externalLogin = true }
2023-08-14 16:28:03 +08:00
}
buildx {
enabled = true
createBuilder = false
2024-01-22 15:26:37 +08:00
platforms =
listOf(
"linux/amd64",
"linux/arm/v7",
"linux/arm64/v8",
)
2023-08-14 16:28:03 +08:00
}
}
}
}