Skip to content

Commit 8fb0796

Browse files
committed
When updating CHANGELOG.md, update version information such as log settings along with the plugin version.
1 parent b176773 commit 8fb0796

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

build.gradle.kts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@ tasks.register("updateChangelog") {
387387
}
388388
}
389389

390-
val newVersion = versionInfo.getNewVersion()
390+
val releaseVersion = versionInfo.getNewVersion()
391391
val prLinks = mutableListOf<String>()
392392
val newEntry = StringBuilder()
393393

394-
newEntry.append("## [$newVersion] - $releaseDate\n\n")
394+
newEntry.append("## [$releaseVersion] - $releaseDate\n\n")
395395
categories.keys.forEach { category ->
396396
val hitItems = categorized[category]
397397
if (!hitItems.isNullOrEmpty()) {
@@ -415,18 +415,18 @@ tasks.register("updateChangelog") {
415415
}
416416
val repoUrl = "https://github.com/domaframework/doma-tools-for-intellij"
417417
changelogFile.writeText(updatedContent)
418-
changelogFile.appendText("[$newVersion]: $repoUrl/compare/$lastTag...$newVersion\n")
418+
changelogFile.appendText("[$releaseVersion]: $repoUrl/compare/$lastTag...$releaseVersion\n")
419419

420420
// Update Version Gradle pluginVersion
421-
replaceVersionGradleProperty(newVersion)
422-
println("Update Gradle Property: $newVersion")
421+
replaceVersion(releaseVersion)
422+
println("Update Version Pre Release: $releaseVersion")
423423

424424
val githubEnv = System.getenv("GITHUB_ENV")
425425
val envFile = File(githubEnv)
426-
envFile.appendText("NEW_VERSION=$newVersion\n")
427-
envFile.appendText("BRANCH=doc/changelog-update-$newVersion\n")
426+
envFile.appendText("NEW_VERSION=$releaseVersion\n")
427+
envFile.appendText("BRANCH=doc/changelog-update-$releaseVersion\n")
428428

429-
println("Update newVersion: $newVersion")
429+
println("Update newVersion: $releaseVersion")
430430
}
431431
}
432432

@@ -542,7 +542,7 @@ spotless {
542542
fun replaceVersionInPluginUtil(ver: String) {
543543
ant.withGroovyBuilder {
544544
"replaceregexp"(
545-
"match" to """(const val PLUGIN_VERSION = ")(\d+\.\d+\.\d+)((?:-beta)*)""",
545+
"match" to """(const val PLUGIN_VERSION = ")(\d+\.\d+\.\d+)((?:-\S+)*)""",
546546
"replace" to "\\1$ver",
547547
"encoding" to encoding,
548548
"flags" to "g",
@@ -557,7 +557,7 @@ fun replaceVersionInPluginUtil(ver: String) {
557557
fun replaceVersionGradleProperty(ver: String) {
558558
ant.withGroovyBuilder {
559559
"replaceregexp"(
560-
"match" to """(pluginVersion = )(\d+\.\d+\.\d+)((?:-beta)*)""",
560+
"match" to """(pluginVersion = )(\d+\.\d+\.\d+)((?:-\S+)*)""",
561561
"replace" to "\\1$ver",
562562
"encoding" to encoding,
563563
"flags" to "g",
@@ -572,7 +572,7 @@ fun replaceVersionGradleProperty(ver: String) {
572572
fun replaceVersionInLogSetting(ver: String) {
573573
ant.withGroovyBuilder {
574574
"replaceregexp"(
575-
"match" to """(org.domaframework.doma.intellij.plugin.version:-)(\d+\.\d+\.\d+)((?:-beta)*)(})""",
575+
"match" to """(org.domaframework.doma.intellij.plugin.version:-)(\d+\.\d+\.\d+)((?:-\S+)*)(})""",
576576
"replace" to "\\1$ver\\4",
577577
"encoding" to encoding,
578578
"flags" to "g",
@@ -588,7 +588,7 @@ fun replaceVersionInLogSetting(ver: String) {
588588
fun replaceVersion(ver: String) {
589589
checkNotNull(ver)
590590
replaceVersionInPluginUtil(ver)
591-
replaceVersionGradleProperty("$ver-beta")
591+
replaceVersionGradleProperty(ver)
592592
replaceVersionInLogSetting(ver)
593593
println("Replace version in PluginUtil.kt, gradle.properties, logback.xml")
594594
}
@@ -609,7 +609,7 @@ tasks.register("replaceNewVersion") {
609609
val minor = lastVersions[1].toInt()
610610
val patch = lastVersions[2].toInt() + 1
611611

612-
val newVersion = "$major.$minor.$patch"
612+
val newVersion = "$major.$minor.$patch-beta"
613613
println("Release newVersion: $newVersion")
614614
replaceVersion(newVersion)
615615
try {
@@ -634,7 +634,7 @@ tasks.register("replaceDraftVersion") {
634634

635635
doLast {
636636
println("Release DraftVersion: $draftVersion")
637-
replaceVersion(draftVersion)
637+
replaceVersion("$draftVersion-beta")
638638
try {
639639
val githubEnv = System.getenv("GITHUB_ENV")
640640
val envFile = File(githubEnv)

0 commit comments

Comments
 (0)