build: move jreleaser to root project

This commit is contained in:
Gauthier Roebroeck 2023-08-14 16:28:03 +08:00
parent 92fce543d6
commit 9222d090c4
2 changed files with 137 additions and 135 deletions

View file

@ -1,4 +1,8 @@
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
plugins {
run {
@ -9,6 +13,7 @@ plugins {
}
id("org.jlleitschuh.gradle.ktlint") version "11.4.2"
id("com.github.ben-manes.versions") version "0.46.0"
id("org.jreleaser") version "1.7.0"
}
fun isNonStable(version: String): Boolean {
@ -19,6 +24,8 @@ fun isNonStable(version: String): Boolean {
return unstableKeyword || !isStable
}
group = "org.gotson"
allprojects {
repositories {
mavenCentral()
@ -44,3 +51,132 @@ tasks.wrapper {
gradleVersion = "8.1.1"
distributionType = Wrapper.DistributionType.ALL
}
jreleaser {
dryrun.set(true)
project {
description.set("Media server for comics/mangas/BDs with API and OPDS support")
copyright.set("Gauthier Roebroeck")
authors.add("Gauthier Roebroeck")
license.set("MIT")
links {
homepage.set("https://komga.org")
}
}
release {
github {
discussionCategoryName.set("Announcements")
changelog {
formatted.set(Active.ALWAYS)
preset.set("conventional-commits")
skipMergeCommits.set(true)
links.set(true)
format.set("- {{#commitIsConventional}}{{#conventionalCommitIsBreakingChange}}🚨 {{/conventionalCommitIsBreakingChange}}{{#conventionalCommitScope}}**{{conventionalCommitScope}}**: {{/conventionalCommitScope}}{{conventionalCommitDescription}}{{#conventionalCommitBreakingChangeContent}}: *{{conventionalCommitBreakingChangeContent}}*{{/conventionalCommitBreakingChangeContent}} ({{commitShortHash}}){{/commitIsConventional}}{{^commitIsConventional}}{{commitTitle}} ({{commitShortHash}}){{/commitIsConventional}}{{#commitHasIssues}}, closes{{#commitIssues}} {{issue}}{{/commitIssues}}{{/commitHasIssues}}")
hide {
uncategorized.set(true)
contributors.set(listOf("Weblate", "GitHub", "semantic-release-bot", "[bot]", "github-actions"))
}
excludeLabels.add("chore")
category {
title.set("🏎 Perf")
key.set("perf")
labels.add("perf")
order.set(25)
}
category {
title.set("🌐 Translation")
key.set("i18n")
labels.add("i18n")
order.set(70)
}
labeler {
label.set("perf")
title.set("regex:^(?:perf(?:\\(.*\\))?!?):\\s.*")
order.set(120)
}
labeler {
label.set("i18n")
title.set("regex:^(?:i18n(?:\\(.*\\))?!?):\\s.*")
order.set(130)
}
extraProperties.put("categorizeScopes", true)
append {
enabled.set(true)
title.set("# [{{projectVersion}}]({{repoUrl}}/compare/{{previousTagName}}...{{tagName}}) ({{#f_now}}YYYY-MM-dd{{/f_now}})")
target.set(rootDir.resolve("CHANGELOG.md"))
content.set(
"""
{{changelogTitle}}
{{changelogChanges}}
""".trimIndent(),
)
}
}
issues {
enabled.set(true)
comment.set("🎉 This issue has been resolved in `{{tagName}}` ([Release Notes]({{releaseNotesUrl}}))")
applyMilestone.set(Apply.ALWAYS)
label {
name.set("released")
description.set("Issue has been released")
color.set("#ededed")
}
}
}
}
files {
active.set(Active.RELEASE)
// workaround as glob doesn't seem to work https://github.com/jreleaser/jreleaser/issues/1466
file("./output/release").listFiles()?.forEach {
artifact {
path.set(it)
}
}
}
distributions {
create("komga") {
active.set(Active.RELEASE)
distributionType.set(SINGLE_JAR)
artifact {
path.set(rootDir.resolve("komga/build/libs/komga-{{projectVersion}}.jar"))
}
}
}
packagers {
docker {
active.set(Active.RELEASE)
continueOnError.set(true)
templateDirectory.set(rootDir.resolve("komga/docker"))
repository.active.set(Active.NEVER)
buildArgs.set(listOf("--cache-from", "gotson/komga:latest"))
imageNames.set(
listOf(
"komga:latest",
"komga:{{projectVersion}}",
"komga:{{projectVersionMajor}}.x",
),
)
registries {
create("docker.io") { externalLogin.set(true) }
create("ghcr.io") { externalLogin.set(true) }
}
buildx {
enabled.set(true)
createBuilder.set(false)
platforms.set(
listOf(
"linux/amd64",
"linux/arm/v7",
"linux/arm64/v8",
),
)
}
}
}
}

View file

@ -1,8 +1,6 @@
import org.apache.tools.ant.taskdefs.condition.Os
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jreleaser.model.Active
import org.jreleaser.model.Distribution.DistributionType.SINGLE_JAR
import org.jreleaser.model.api.common.Apply
plugins {
run {
@ -16,14 +14,11 @@ plugins {
id("org.flywaydb.flyway") version "9.7.0"
id("com.github.johnrengelman.processes") version "0.5.0"
id("org.springdoc.openapi-gradle-plugin") version "1.6.0"
id("org.jreleaser") version "1.6.0"
id("com.google.devtools.ksp") version "1.8.22-1.0.11"
jacoco
}
group = "org.gotson"
kotlin {
jvmToolchain(17)
}
@ -315,137 +310,8 @@ configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
}
}
jreleaser {
gitRootSearch.set(true)
project {
description.set("Media server for comics/mangas/BDs with API and OPDS support")
copyright.set("Gauthier Roebroeck")
authors.add("Gauthier Roebroeck")
license.set("MIT")
links {
homepage.set("https://komga.org")
}
}
release {
github {
discussionCategoryName.set("Announcements")
changelog {
formatted.set(Active.ALWAYS)
preset.set("conventional-commits")
skipMergeCommits.set(true)
links.set(true)
format.set("- {{#commitIsConventional}}{{#conventionalCommitIsBreakingChange}}🚨 {{/conventionalCommitIsBreakingChange}}{{#conventionalCommitScope}}**{{conventionalCommitScope}}**: {{/conventionalCommitScope}}{{conventionalCommitDescription}}{{#conventionalCommitBreakingChangeContent}}: *{{conventionalCommitBreakingChangeContent}}*{{/conventionalCommitBreakingChangeContent}} ({{commitShortHash}}){{/commitIsConventional}}{{^commitIsConventional}}{{commitTitle}} ({{commitShortHash}}){{/commitIsConventional}}{{#commitHasIssues}}, closes{{#commitIssues}} {{issue}}{{/commitIssues}}{{/commitHasIssues}}")
hide {
uncategorized.set(true)
contributors.set(listOf("Weblate", "GitHub", "semantic-release-bot", "[bot]", "github-actions"))
}
excludeLabels.add("chore")
category {
title.set("🏎 Perf")
key.set("perf")
labels.add("perf")
order.set(25)
}
category {
title.set("🌐 Translation")
key.set("i18n")
labels.add("i18n")
order.set(70)
}
labeler {
label.set("perf")
title.set("regex:^(?:perf(?:\\(.*\\))?!?):\\s.*")
order.set(120)
}
labeler {
label.set("i18n")
title.set("regex:^(?:i18n(?:\\(.*\\))?!?):\\s.*")
order.set(130)
}
extraProperties.put("categorizeScopes", true)
append {
enabled.set(true)
title.set("# [{{projectVersion}}]({{repoUrl}}/compare/{{previousTagName}}...{{tagName}}) ({{#f_now}}YYYY-MM-dd{{/f_now}})")
target.set(rootDir.resolve("CHANGELOG.md"))
content.set(
"""
{{changelogTitle}}
{{changelogChanges}}
""".trimIndent(),
)
}
}
issues {
enabled.set(true)
comment.set("🎉 This issue has been resolved in `{{tagName}}` ([Release Notes]({{releaseNotesUrl}}))")
applyMilestone.set(Apply.ALWAYS)
label {
name.set("released")
description.set("Issue has been released")
color.set("#ededed")
}
}
}
}
checksum.individual.set(true)
distributions {
create("komga") {
distributionType.set(SINGLE_JAR)
artifact {
path.set(files(tasks.bootJar).singleFile)
}
}
}
packagers {
docker {
active.set(Active.RELEASE)
continueOnError.set(true)
templateDirectory.set(projectDir.resolve("docker"))
repository.active.set(Active.NEVER)
buildArgs.set(listOf("--cache-from", "gotson/komga:latest"))
imageNames.set(
listOf(
"komga:latest",
"komga:{{projectVersion}}",
"komga:{{projectVersionMajor}}.x",
),
)
registries {
create("docker.io") { externalLogin.set(true) }
create("ghcr.io") { externalLogin.set(true) }
}
buildx {
enabled.set(true)
createBuilder.set(false)
platforms.set(
listOf(
"linux/amd64",
"linux/arm/v7",
"linux/arm64/v8",
),
)
}
}
}
}
project.afterEvaluate {
tasks.named("forkedSpringBootRun") {
mustRunAfter(tasks.bootJar)
}
}
tasks.jreleaserPackage {
inputs.files(tasks.bootJar)
}
// Workaround for https://github.com/jreleaser/jreleaser/issues/1231
tasks.jreleaserFullRelease {
inputs.files(tasks.bootJar)
}