diff --git a/src/main/java/io/quarkus/bot/release/ReleaseInformation.java b/src/main/java/io/quarkus/bot/release/ReleaseInformation.java index 7690468..b99ec92 100644 --- a/src/main/java/io/quarkus/bot/release/ReleaseInformation.java +++ b/src/main/java/io/quarkus/bot/release/ReleaseInformation.java @@ -12,13 +12,15 @@ public class ReleaseInformation { private final boolean major; private String version; + private boolean maintenance; @JsonCreator - public ReleaseInformation(String version, String branch, String qualifier, boolean major) { + public ReleaseInformation(String version, String branch, String qualifier, boolean major, boolean maintenance) { this.version = version; this.branch = branch; this.qualifier = qualifier; this.major = major; + this.maintenance = maintenance; } public String getVersion() { @@ -33,10 +35,18 @@ public String getQualifier() { return qualifier; } + public boolean isMaintenance() { + return maintenance; + } + public void setVersion(String version) { this.version = version; } + public void setMaintenance(boolean maintenance) { + this.maintenance = maintenance; + } + @JsonIgnore public boolean isFinal() { return qualifier == null || qualifier.isBlank() || qualifier.equals("Final"); @@ -80,7 +90,7 @@ public boolean equals(Object obj) { @Override public String toString() { - return "ReleaseInformation [version=" + version + ", branch=" + branch + ", qualifier=" + qualifier + ", major=" + major + return "ReleaseInformation [version=" + version + ", branch=" + branch + ", qualifier=" + qualifier + ", major=" + major + ",maintenance=" + maintenance + "]"; } } diff --git a/src/main/java/io/quarkus/bot/release/step/AnnounceRelease.java b/src/main/java/io/quarkus/bot/release/step/AnnounceRelease.java index be87049..974a8e0 100644 --- a/src/main/java/io/quarkus/bot/release/step/AnnounceRelease.java +++ b/src/main/java/io/quarkus/bot/release/step/AnnounceRelease.java @@ -36,7 +36,9 @@ public int run(Context context, Commands commands, ReleaseInformation releaseInf if (releaseInformation.isFinal()) { comment.append("Time to write the announcement:\n\n"); - comment.append("* Update the versions in `_data/versions.yaml`\n"); + if (!releaseInformation.isMaintenance()) { + comment.append("* Update the versions in `_data/versions.yaml`\n"); + } comment.append("* Write a blog post for [the website](https://github.com/quarkusio/quarkusio.github.io)\n"); comment.append( " * Use a previous announcement as a template (be aware, annoucements are very different for the first final of a major/minor and the follow-up micros)\n"); diff --git a/src/main/java/io/quarkus/bot/release/step/ApproveCoreRelease.java b/src/main/java/io/quarkus/bot/release/step/ApproveCoreRelease.java index 9d02dc8..b171982 100644 --- a/src/main/java/io/quarkus/bot/release/step/ApproveCoreRelease.java +++ b/src/main/java/io/quarkus/bot/release/step/ApproveCoreRelease.java @@ -1,8 +1,6 @@ package io.quarkus.bot.release.step; import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; import jakarta.inject.Inject; import jakarta.inject.Singleton; @@ -35,10 +33,10 @@ public boolean shouldPause(Context context, Commands commands, ReleaseInformatio comment.append("- Quarkus `").append(releaseInformation.getVersion()).append("`\n"); comment.append("- On branch `").append(releaseInformation.getBranch()).append("`\n"); comment.append("- With Java `").append(jdks.getJdkVersion(releaseInformation.getBranch())).append("`\n"); - if (Files.exists(Path.of("work", "maintenance"))) { + if (releaseInformation.isMaintenance()) { comment.append("- This is a `maintenance` release.\n"); } - if (Files.exists(Path.of("work", "preview"))) { + if (!releaseInformation.isFinal()) { comment.append("- This is a `preview` release (e.g. `Alpha`, `Beta`, `CR`).\n"); } diff --git a/src/main/java/io/quarkus/bot/release/step/Prerequisites.java b/src/main/java/io/quarkus/bot/release/step/Prerequisites.java index f2b1874..471be8c 100644 --- a/src/main/java/io/quarkus/bot/release/step/Prerequisites.java +++ b/src/main/java/io/quarkus/bot/release/step/Prerequisites.java @@ -49,6 +49,7 @@ public int run(Context context, Commands commands, ReleaseInformation releaseInf } releaseInformation.setVersion(Files.readString(Path.of("work", "newVersion")).trim()); + releaseInformation.setMaintenance(Files.exists(Path.of("work", "maintenance"))); issues.appendReleaseInformation(updatedIssueBody, releaseInformation); return exitCode; diff --git a/src/main/java/io/quarkus/bot/release/util/Issues.java b/src/main/java/io/quarkus/bot/release/util/Issues.java index 6728589..cea22ed 100644 --- a/src/main/java/io/quarkus/bot/release/util/Issues.java +++ b/src/main/java/io/quarkus/bot/release/util/Issues.java @@ -79,7 +79,7 @@ public ReleaseInformation extractReleaseInformationFromForm(String description) throw new IllegalStateException("Unable to extract a branch from the description"); } - return new ReleaseInformation(null, branch, qualifier, major); + return new ReleaseInformation(null, branch, qualifier, major, false); } public ReleaseInformation extractReleaseInformation(UpdatedIssueBody updatedIssueBody) { diff --git a/src/test/java/io/quarkus/bot/release/BranchesTest.java b/src/test/java/io/quarkus/bot/release/BranchesTest.java index 61d49e3..0aeadeb 100644 --- a/src/test/java/io/quarkus/bot/release/BranchesTest.java +++ b/src/test/java/io/quarkus/bot/release/BranchesTest.java @@ -12,7 +12,7 @@ public class BranchesTest { @Test void testPreviewRelease() { - ReleaseInformation releaseInformation = new ReleaseInformation("3.6.0.CR1", "3.6", "CR1", false); + ReleaseInformation releaseInformation = new ReleaseInformation("3.6.0.CR1", "3.6", "CR1", false, false); assertThat(Branches.getPlatformPreparationBranch(releaseInformation)).isEqualTo(Branches.MAIN); assertThat(Branches.getPlatformReleaseBranch(releaseInformation)).isEqualTo(Branches.MAIN); @@ -20,7 +20,7 @@ void testPreviewRelease() { @Test void testFirstFinalRelease() { - ReleaseInformation releaseInformation = new ReleaseInformation("3.6.0", "3.6", null, false); + ReleaseInformation releaseInformation = new ReleaseInformation("3.6.0", "3.6", null, false, false); assertThat(Branches.getPlatformPreparationBranch(releaseInformation)).isEqualTo(Branches.MAIN); assertThat(Branches.getPlatformReleaseBranch(releaseInformation)).isEqualTo("3.6"); @@ -28,7 +28,7 @@ void testFirstFinalRelease() { @Test void testBugfixFinalRelease() { - ReleaseInformation releaseInformation = new ReleaseInformation("3.6.1", "3.6", null, false); + ReleaseInformation releaseInformation = new ReleaseInformation("3.6.1", "3.6", null, false, false); assertThat(Branches.getPlatformPreparationBranch(releaseInformation)).isEqualTo("3.6"); assertThat(Branches.getPlatformReleaseBranch(releaseInformation)).isEqualTo("3.6"); diff --git a/src/test/java/io/quarkus/bot/release/IssuesTest.java b/src/test/java/io/quarkus/bot/release/IssuesTest.java index 1f6c44d..609bfdb 100644 --- a/src/test/java/io/quarkus/bot/release/IssuesTest.java +++ b/src/test/java/io/quarkus/bot/release/IssuesTest.java @@ -35,7 +35,7 @@ void testExtractReleaseInformationFromForm() { - [ ] This release is a major version. """; - assertThat(issues.extractReleaseInformationFromForm(description)).isEqualTo(new ReleaseInformation(null, "3.6", null, false)); + assertThat(issues.extractReleaseInformationFromForm(description)).isEqualTo(new ReleaseInformation(null, "3.6", null, false, false)); description = """ ### Branch @@ -51,14 +51,14 @@ void testExtractReleaseInformationFromForm() { - [X] This release is a major version. """; - assertThat(issues.extractReleaseInformationFromForm(description)).isEqualTo(new ReleaseInformation(null, "main", "CR1", true)); + assertThat(issues.extractReleaseInformationFromForm(description)).isEqualTo(new ReleaseInformation(null, "main", "CR1", true, false)); assertThrows(IllegalStateException.class, () -> issues.extractReleaseInformationFromForm("foobar")); } @Test void testAppendReleaseInformation() { - assertThat(issues.appendReleaseInformation(new UpdatedIssueBody(""), new ReleaseInformation(null, "3.6", null, false))).isEqualTo(""" + assertThat(issues.appendReleaseInformation(new UpdatedIssueBody(""), new ReleaseInformation(null, "3.6", null, false, false))).isEqualTo(""" """); assertThat(issues.appendReleaseInformation(new UpdatedIssueBody(""" @@ -77,7 +78,8 @@ void testAppendReleaseInformation() { branch: "3.6" qualifier: null major: false - -->"""), new ReleaseInformation("3.7.1", "3.7", "CR1", true))).isEqualTo(""" + maintenance: false + -->"""), new ReleaseInformation("3.7.1", "3.7", "CR1", true, false))).isEqualTo(""" This is a comment. """); } @@ -100,6 +103,7 @@ void testExtractReleaseInformation() { branch: "4.0" qualifier: CR1 major: true + maintenance: true --> """))).isEqualTo(new ReleaseInformation(null, "4.0", "CR1", true)); + -->"""))).isEqualTo(new ReleaseInformation(null, "4.0", "CR1", true, true)); assertThat(issues.extractReleaseInformation(new UpdatedIssueBody(""" This is a comment. @@ -118,6 +122,7 @@ void testExtractReleaseInformation() { branch: "4.0" qualifier: CR1 major: true + maintenance: false --> """))).isEqualTo(new ReleaseInformation("4.0.0.CR1", "4.0", "CR1", true)); + -->"""))).isEqualTo(new ReleaseInformation("4.0.0.CR1", "4.0", "CR1", true, false)); } @Test