From 118fa39ff3aeeed11ba977db448d6eb51854ab14 Mon Sep 17 00:00:00 2001 From: Julien Ponge Date: Fri, 22 Nov 2024 18:57:20 +0100 Subject: [PATCH 1/2] build(release): remove outdated build and release files The remaining JBang scripts have also been updated to fresher dependencies. Fixes: #1711 --- .build/BlameAPI.java | 8 +- .build/CompatibilityUtils.java | 5 +- .build/Helper.java | 69 -------- .build/PostRelease.java | 164 ------------------ .build/PreRelease.java | 116 ------------- .build/UpdateDocsAttributesFiles.java | 4 +- .build/WaitForCentral.java | 7 +- .build/cut-release.sh | 79 --------- .build/deploy-release.sh | 22 --- .build/deploy-snapshot.sh | 21 --- .build/justfile-for-release | 78 --------- .build/mock-events/README.md | 23 --- .../mock-events/release-workflow-event.json | 7 - .build/mock-events/tag-creation-event.json | 5 - .build/update-workshop-target-version.sh | 3 - 15 files changed, 11 insertions(+), 600 deletions(-) delete mode 100644 .build/Helper.java delete mode 100644 .build/PostRelease.java delete mode 100644 .build/PreRelease.java delete mode 100755 .build/cut-release.sh delete mode 100755 .build/deploy-release.sh delete mode 100755 .build/deploy-snapshot.sh delete mode 100644 .build/justfile-for-release delete mode 100644 .build/mock-events/README.md delete mode 100644 .build/mock-events/release-workflow-event.json delete mode 100644 .build/mock-events/tag-creation-event.json delete mode 100755 .build/update-workshop-target-version.sh diff --git a/.build/BlameAPI.java b/.build/BlameAPI.java index d7c287821..220aa1e70 100755 --- a/.build/BlameAPI.java +++ b/.build/BlameAPI.java @@ -1,8 +1,8 @@ ///usr/bin/env jbang "$0" "$@" ; exit $? -//DEPS info.picocli:picocli:4.6.2 -//DEPS org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r -//DEPS com.google.guava:guava:31.0-jre -//DEPS org.slf4j:slf4j-simple:1.7.32 +//DEPS info.picocli:picocli:4.7.6 +//DEPS org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r +//DEPS com.google.guava:guava:33.3.1-jre +//DEPS org.slf4j:slf4j-simple:2.0.16 import java.io.File; import java.io.IOException; diff --git a/.build/CompatibilityUtils.java b/.build/CompatibilityUtils.java index 074bd31ee..9e86c2ec4 100755 --- a/.build/CompatibilityUtils.java +++ b/.build/CompatibilityUtils.java @@ -1,6 +1,7 @@ ///usr/bin/env jbang "$0" "$@" ; exit $? # (1) -//DEPS io.vertx:vertx-core:3.9.4 -//DEPS info.picocli:picocli:4.6.3 +//DEPS io.vertx:vertx-core:4.5.11 +//DEPS com.fasterxml.jackson.core:jackson-annotations:2.18.1 +//DEPS info.picocli:picocli:4.7.6 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/.build/Helper.java b/.build/Helper.java deleted file mode 100644 index 91400e7e3..000000000 --- a/.build/Helper.java +++ /dev/null @@ -1,69 +0,0 @@ -package helpers; - -import org.kohsuke.github.GHRelease; -import org.kohsuke.github.GHRepository; -import org.kohsuke.github.GHTag; - -import java.io.IOException; -import java.util.Collection; -import java.util.function.Supplier; - - -public class Helper { - - public static void info(String msg, Object... params) { - System.out.println("[INFO] " + String.format(msg, params)); - } - - public static void completed(String msg, Object... params) { - System.out.println("[DONE] " + String.format(msg, params)); - } - - public static void success(String msg, Object... params) { - System.out.println("[WARN] " + String.format(msg, params)); - } - - public static void warn(String msg, Object... params) { - System.out.println("[WARN] " + String.format(msg, params)); - } - - public static void fail(String msg, Object... params) { - fail(String.format(msg, params), 2); - } - - public static void fail(String msg, int code) { - System.out.println("[FAIL] " + msg); - System.exit(code); - } - - public static void failIfTrue(Supplier predicate, String message, Object... params) { - if (predicate.get()) { - fail(message, params); - } - } - - public static T first(Collection collection) { - if (collection.isEmpty()) { - fail("Cannot retrieve the first item from an empty collection"); - } - return collection.iterator().next(); - } - - public static String computeNextVersion(GHRepository repository, GHTag tag, boolean micro) throws IOException { - info("Retrieving release associated with tag %s", tag.getName()); - GHRelease name = repository.getReleaseByTagName(tag.getName()); - if (name == null) { - warn("No release associated with tag %s", tag.getName()); - } - String[] segments = tag.getName().split("\\."); - if (segments.length < 3) { - fail("Invalid version %s, number of segments must be at least 3, found %d", tag.getName(), segments.length); - } - - if (micro) { - return String.format("%s.%s.%d", segments[0], segments[1], Integer.parseInt(segments[2]) + 1); - } else { - return String.format("%s.%d.0", segments[0], Integer.parseInt(segments[1]) + 1); - } - } -} \ No newline at end of file diff --git a/.build/PostRelease.java b/.build/PostRelease.java deleted file mode 100644 index b3c59d53b..000000000 --- a/.build/PostRelease.java +++ /dev/null @@ -1,164 +0,0 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? -//DEPS org.kohsuke:github-api:1.117 -//DEPS info.picocli:picocli:4.5.0 -//SOURCES Helper.java - -import org.kohsuke.github.*; -import picocli.CommandLine; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.Callable; -import java.util.stream.Collectors; - -import static helpers.Helper.*; - -/** - * Script run after the release. - * The script does the following action in this order: - * - checks that the previous milestone is closed, close it if not - * - checks that the next milestone exists, or create it if not - * - creates the Github release and compute the release notes - *

- * Run with `./PostRelease.java --token=GITHUB_TOKEN --release-version=version - *

- * 1. The github token is mandatory. - *

- * The version is taken from the last tag if not set. - */ -@CommandLine.Command(name = "post-release", mixinStandardHelpOptions = true, version = "0.1", - description = "Post-Release Check") -public class PostRelease implements Callable { - - @CommandLine.Option(names = "--token", description = "The Github Token", required = true) - private String token; - - @CommandLine.Option(names = "--release-version", description = "Set the released version", required = true) - private String releaseVersion; - - private static final String REPO = "smallrye/smallrye-mutiny"; - - public static void main(String... args) { - int exitCode = new CommandLine(new PostRelease()).execute(args); - System.exit(exitCode); - } - - @Override - public Integer call() throws Exception { - GitHub gitHub = new GitHubBuilder().withOAuthToken(token).build(); - GHRepository repository = gitHub.getRepository(REPO); - - List tags = repository.listTags().toList(); - List milestones = repository.listMilestones(GHIssueState.ALL).toList(); - - info("Running post-release checks for release %s", releaseVersion); - - // Check that the tag associated with the release version exists - GHTag tag = getTag(releaseVersion, tags); - - assert tag != null; - - // Check that the milestone exists (this check has already been done during the pre-release checks, just to be double sure) - GHMilestone milestone = milestones.stream().filter(m -> m.getTitle().equals(releaseVersion)).findFirst() - .orElse(null); - failIfTrue(() -> milestone == null, "Unable to find the milestone %s", releaseVersion); - assert milestone != null; - success("Milestone %s found (%s)", milestone.getTitle(), milestone.getHtmlUrl()); - - success("Post-release check successful"); - info("Starting post-release tasks"); - - // Close milestone - if (milestone.getState() != GHMilestoneState.CLOSED) { - milestone.close(); - success("Milestone %s closed (%s)", milestone.getTitle(), milestone.getHtmlUrl()); - } else { - success("Milestone %s already closed (%s)", milestone.getTitle(), milestone.getHtmlUrl()); - } - - // Compute next version - String nextVersion = getNextVersion(releaseVersion); - success("Next version will be %s", nextVersion); - - // Create new milestone if it does not already exist - GHMilestone nextMilestone = milestones.stream().filter(m -> m.getTitle().equals(nextVersion)).findFirst() - .orElse(null); - if (nextMilestone != null) { - success("Next milestone (%s) already exists: %s", nextMilestone.getTitle(), nextMilestone.getHtmlUrl()); - } else { - nextMilestone = repository.createMilestone(nextVersion, null); - success("Next milestone (%s) created: %s", nextMilestone.getTitle(), nextMilestone.getHtmlUrl()); - } - - // Compute the release notes and create releases - List issues = repository.getIssues(GHIssueState.CLOSED, milestone); - String description = createReleaseDescription(issues); - // Check if release already exists - GHRelease existingRelease = repository.getReleaseByTagName(tag.getName()); - if (existingRelease != null) { - info("Release %s already exists (%s) - skip release note generation", existingRelease.getName(), existingRelease.getHtmlUrl()); - info("Generated release notes:\n%s", description); - - if (existingRelease.isDraft()) { - existingRelease.update().draft(false); - success("Marked release %s as non-draft", existingRelease.getName()); - } - } else { - GHRelease release = repository.createRelease(releaseVersion) - .name(releaseVersion) - .body(description) - .create(); - success("Release %s created: %s", releaseVersion, release.getHtmlUrl()); - } - - completed("Post-Release done!"); - - return 0; - } - - private GHTag getTag(String releaseVersion, List tags) { - failIfTrue(tags::isEmpty, "No tags found in repository"); - Optional first = tags.stream().filter(tag -> tag.getName().equals(releaseVersion)).findFirst(); - if (first.isPresent()) { - success("Tag %s found", releaseVersion); - return first.get(); - } - fail("Unable to find the tag %s in the repository", releaseVersion); - return null; - } - - private String getNextVersion(String v) { - String[] segments = v.split("\\."); - if (segments.length < 3) { - fail("Invalid version %s, number of segments must be at least 3, found %d", v, segments.length); - } - - return String.format("%s.%d.0", segments[0], Integer.parseInt(segments[1]) + 1); - } - - private String createReleaseDescription(List issues) throws IOException { - File file = new File("target/differences.md"); - String compatibility = ""; - if (file.isFile()) { - compatibility += new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); - } - - StringBuilder desc = new StringBuilder(); - desc.append("### Changelog\n\n"); - List list = issues.stream().map(this::line).collect(Collectors.toList()); - desc.append(String.join("\n", list)); - desc.append("\n"); - - desc.append(compatibility).append("\n"); - return desc.toString(); - } - - private String line(GHIssue issue) { - return String.format(" * [#%d](%s) - %s", issue.getNumber(), issue.getHtmlUrl(), issue.getTitle()); - } - -} diff --git a/.build/PreRelease.java b/.build/PreRelease.java deleted file mode 100644 index bcd573f0f..000000000 --- a/.build/PreRelease.java +++ /dev/null @@ -1,116 +0,0 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? -//DEPS org.kohsuke:github-api:1.117 -//DEPS info.picocli:picocli:4.5.0 -//SOURCES Helper.java - -import org.kohsuke.github.*; -import picocli.CommandLine; - -import java.io.File; -import java.nio.file.Files; -import java.util.List; -import java.util.concurrent.Callable; - -import static helpers.Helper.*; - -/** - * Script checking that the repository can be released. - * It checks that: - * - the new version target an existing milestone - * - the milestone has no opened issues - * - the tag does not exist - * - * Run with `./PreRelease.java --token=GITHUB_TOKEN [--micro] [--release-version=version] - */ -@CommandLine.Command(name = "pre-release", mixinStandardHelpOptions = true, version = "0.1", - description = "Pre-Release Check") -public class PreRelease implements Callable { - - @CommandLine.Option(names = "--token", description = "The Github Token", required = true) - private String token; - - @CommandLine.Option(names = "--micro", description = "To set the release to be a micro release", defaultValue = "false") - private boolean micro; - - @CommandLine.Option(names = "--release-version", description = "Set the released version - if not set, the version is computed") - private String target; - - private static final String REPO = "smallrye/smallrye-mutiny"; - - public static void main(String... args) { - int exitCode = new CommandLine(new PreRelease()).execute(args); - System.exit(exitCode); - } - - @Override - public Integer call() throws Exception { - if (micro) { - info("Preparing micro release"); - } else { - info("Preparing release"); - } - - GitHub gitHub = new GitHubBuilder().withOAuthToken(token).build(); - GHRepository repository = gitHub.getRepository(REPO); - - List tags = repository.listTags().toList(); - List milestones = repository.listMilestones(GHIssueState.ALL).toList(); - - String newVersion; - if (target != null && ! target.trim().isEmpty()) { - newVersion = target; - } else { - info("No version passed, computing new version from the last tag"); - GHTag tag = getLastTag(tags); - newVersion = computeNextVersion(repository, tag, micro); - } - info("Released version would be %s", newVersion); - - info("Running pre-checks..."); - failIfTrue(milestones::isEmpty, "No milestones in repository %s", repository.getName()); - - // Check that the is no tag with the name newVersion - if (tags.stream().anyMatch(t -> t.getName().equals(newVersion))) { - fail("Cannot cut release %s - there is already a tag with this version", newVersion); - } - success("No existing tag named %s", newVersion); - - // Check that there is a milestone named newVersion - GHMilestone milestone = milestones.stream().filter(m -> m.getTitle().equals(newVersion)).findFirst().orElse(null); - if (milestone == null) { - fail("No milestone named %s in repository %s - you need to create one", newVersion, repository.getName()); - } else { - success("Milestone %s found with %d closed issues", - milestone.getTitle(), - milestone.getClosedIssues()); - } - - assert milestone != null; - // Check that all the issues associated with the milestone are closed - failIfTrue(() -> milestone.getOpenIssues() != 0, "The milestone %s has %d opened issues, all the issues " - + "must be closed or moved to another milestone before being able to cut the release. Visit %s for details", - milestone.getTitle(), milestone.getOpenIssues(), milestone.getHtmlUrl().toExternalForm()); - success("No remaining (open) issue associated with the milestone %s", milestone.getTitle()); - - success("Release pre-checks successful!"); - info("Writing release version in the /tmp/release-version file"); - Files.write(new File("/tmp/release-version").toPath(), newVersion.getBytes()); - if (micro) { - //noinspection ResultOfMethodCallIgnored - new File("/tmp/micro").createNewFile(); - } - - completed("Pre-release checks completed!"); - - return 0; - } - - private GHTag getLastTag(List tags) { - failIfTrue(tags::isEmpty, "No tags found in repository"); - GHTag tag = first(tags); - assert tag != null; - success("Last tag retrieved: %s", tag.getName()); - return tag; - } - -} diff --git a/.build/UpdateDocsAttributesFiles.java b/.build/UpdateDocsAttributesFiles.java index cfa509da4..a659c8aa5 100755 --- a/.build/UpdateDocsAttributesFiles.java +++ b/.build/UpdateDocsAttributesFiles.java @@ -1,6 +1,6 @@ ///usr/bin/env jbang "$0" "$@" ; exit $? -//DEPS org.kohsuke:github-api:1.307 -//DEPS info.picocli:picocli:4.6.3 +//DEPS org.kohsuke:github-api:1.326 +//DEPS info.picocli:picocli:4.7.6 import org.kohsuke.github.GitHub; import org.kohsuke.github.GitHubBuilder; diff --git a/.build/WaitForCentral.java b/.build/WaitForCentral.java index 0d0df5985..15d4a561a 100755 --- a/.build/WaitForCentral.java +++ b/.build/WaitForCentral.java @@ -1,8 +1,6 @@ ///usr/bin/env jbang "$0" "$@" ; exit $? # (1) -//DEPS io.vertx:vertx-core:3.9.4 -//DEPS info.picocli:picocli:4.5.0 -//DEPS io.smallrye.reactive:smallrye-mutiny-vertx-web-client:1.4.0 - +//DEPS info.picocli:picocli:4.7.6 +//DEPS io.smallrye.reactive:smallrye-mutiny-vertx-web-client:3.16.0 import picocli.CommandLine; import picocli.CommandLine.Command; @@ -17,7 +15,6 @@ import io.vertx.mutiny.core.Vertx; import io.vertx.mutiny.ext.web.client.WebClient; - @Command(name = "wait-for-central", mixinStandardHelpOptions = true, version = "0.1", description = "Wait until artifacts lands on Maven Central:\n./WaitForCentral.java --artifacts=io.smallrye.reactive:mutiny,io.smallrye.reactive:mutiny-context-propagation --expected-version=0.13.0") class WaitForCentral implements Callable { diff --git a/.build/cut-release.sh b/.build/cut-release.sh deleted file mode 100755 index ec4527984..000000000 --- a/.build/cut-release.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env bash -set -e - -init_gpg() { - gpg2 --fast-import --no-tty --batch --yes smallrye-sign.asc -} - -init_git() { - git config --global user.name "${GITHUB_ACTOR}" - git config --global user.email "smallrye@googlegroups.com" -} - -# -------- SCRIPT START HERE ----------------- - -init_git -init_gpg - -export VERSION="" -export BRANCH="HEAD" -export EXTRA_PRE_ARGS="" - -if [[ ${DRY_RUN} == "true" ]]; then - echo "[DRY RUN] - Dry Run Enabled - Git push will be skipped." -fi - -if [[ ${MICRO_RELEASE} == "true" ]]; then - EXTRA_PRE_ARGS="--micro" -fi - -if [[ ! -z "${RELEASE_VERSION}" ]]; then - EXTRA_PRE_ARGS="${EXTRA_PRE_ARGS} --release-version=${RELEASE_VERSION}" -fi - -jbang .build/PreRelease.java --token="${GITHUB_TOKEN}" ${EXTRA_PRE_ARGS} - -export VERSION="" -if [ -f /tmp/release-version ]; then - VERSION=$(cat /tmp/release-version) -else - echo "'/tmp/release-version' expected after pre-release" - exit 1 -fi - -echo "Update website version to ${VERSION}" -.build/UpdateDocsAttributesFiles.java --mutiny-version=${VERSION} -if [[ $(git diff --stat) != '' ]]; then - git add documentation/attributes.yaml - git commit -m "Bumping the website version to ${VERSION}" - git push - echo "Version updated" -else - echo "The version was already correct" -fi - -echo "Cutting release ${VERSION}" -./mvnw -s .build/maven-ci-settings.xml -B -fn clean -git checkout ${BRANCH} -HASH=$(git rev-parse --verify $BRANCH) -echo "Last commit is ${HASH} - creating detached branch" -git checkout -b "r${VERSION}" "${HASH}" - -echo "Update version to ${VERSION}" -./mvnw -B versions:set -DnewVersion="${VERSION}" -DgenerateBackupPoms=false -s maven-settings.xml -./mvnw -B versions:set -DnewVersion="${VERSION}" -DgenerateBackupPoms=false -s maven-settings.xml -pl bom - -if [[ ${SKIP_TESTS} == "true" ]]; then - ./mvnw -B clean verify -Prelease -DskipTests -s maven-settings.xml -else - ./mvnw -B clean verify -Prelease -s maven-settings.xml -fi - -git commit -am "[RELEASE] - Bump version to ${VERSION}" -git tag "${VERSION}" -echo "Pushing tag to origin" -if [[ ${DRY_RUN} == "true" ]]; then - echo "[DRY RUN] - Skipping push: git push origin ${VERSION}" -else - git push origin "${VERSION}" -fi \ No newline at end of file diff --git a/.build/deploy-release.sh b/.build/deploy-release.sh deleted file mode 100755 index 9db44c041..000000000 --- a/.build/deploy-release.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -e - -init_gpg() { - gpg2 --fast-import --no-tty --batch --yes smallrye-sign.asc -} - -init_git() { - git config --global user.name "${GITHUB_ACTOR}" - git config --global user.email "smallrye@googlegroups.com" -} - -# -------- SCRIPT START HERE ----------------- - -init_git -init_gpg - -git fetch origin --tags -git reset --hard -git checkout "${REF}" -./mvnw -B clean deploy -DskipTests -Prelease -s maven-settings.xml - diff --git a/.build/deploy-snapshot.sh b/.build/deploy-snapshot.sh deleted file mode 100755 index dfe6797c8..000000000 --- a/.build/deploy-snapshot.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -init_gpg() { - gpg2 --fast-import --no-tty --batch --yes smallrye-sign.asc -} - -init_git() { - git config --global user.name "${GITHUB_ACTOR}" - git config --global user.email "smallrye@googlegroups.com" -} - -# -------- SCRIPT START HERE ----------------- - -init_git -init_gpg - -git fetch origin --tags -git reset --hard -git checkout main -./mvnw --no-transfer-progress -B clean deploy -DskipTests -Prelease -s maven-settings.xml - diff --git a/.build/justfile-for-release b/.build/justfile-for-release deleted file mode 100644 index 82a8f5c71..000000000 --- a/.build/justfile-for-release +++ /dev/null @@ -1,78 +0,0 @@ -# Should be run as: -# just -f .build/justfile-for-release -d . (...) - -set shell := ["bash", "-uc"] - -# Just echo the purpose of this file -purpose: - @echo "This file is used to automate some release tasks" - @echo "(running in `pwd`)" - -# Perform a release -perform-release: pre-release release post-release - @echo "🎉 Successfully released Mutiny ${RELEASE_VERSION} 🚀" - -# Initialize Git -init-git: - @echo "Git setup" - git config --global user.name "smallrye-ci" - git config --global user.email "smallrye@googlegroups.com" - -# Steps before releasing -pre-release: init-git - @echo "🚀 Pre-release steps..." - @echo "Pre-release verifications" - jbang .build/PreRelease.java --token=${RELEASE_TOKEN} --release-version=${RELEASE_VERSION} - @echo "Bump project version to ${RELEASE_VERSION}" - ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${RELEASE_VERSION} -DgenerateBackupPoms=false - ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=${RELEASE_VERSION} -DgenerateBackupPoms=false -pl bom - jbang .build/UpdateDocsAttributesFiles.java --mutiny-version=${RELEASE_VERSION} - @echo "Check that the project builds (no tests)" - ./mvnw --batch-mode --no-transfer-progress clean install -Prelease -DskipTests - @echo "Bump workshop examples to ${RELEASE_VERSION}" - .build/update-workshop-target-version.sh "${RELEASE_VERSION}" - @echo "Check that the website builds" - -[[ ${DEPLOY_WEBSITE} == "true" ]] && cd documentation && pipenv run mkdocs build - -# Steps to release -release: pre-release - @echo "🚀 Release steps..." - @echo "Commit release version and push upstream" - git commit -am "chore(release): release Mutiny ${RELEASE_VERSION}" - git push - @echo "Call JReleaser" - ./mvnw --batch-mode --no-transfer-progress -Pjreleaser jreleaser:full-release -pl :mutiny-project - @echo "Bump to 999-SNAPSHOT and push upstream" - ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=999-SNAPSHOT -DgenerateBackupPoms=false - ./mvnw --batch-mode --no-transfer-progress versions:set -DnewVersion=999-SNAPSHOT -DgenerateBackupPoms=false -pl bom - git commit -am "chore(release): set development version to 999-SNAPSHOT" - git push - -# Deploy to Maven Central -deploy-to-maven-central: - @echo "Deploy to Maven Central" - ./mvnw --batch-mode --no-transfer-progress deploy -Prelease -DskipTests - -# Deploy snapshots to Maven Central -deploy-snapshots-to-maven-central: - @echo "Deploy snapshots to Maven Central" - ./mvnw --batch-mode --no-transfer-progress deploy -DskipTests - -# Steps post-release -post-release: - @echo "🚀 Post-release steps..." - -[[ ${CLEAR_REVAPI} == "true" ]] && just -f .build/justfile-for-release -d . clear-revapi - -[[ ${DEPLOY_WEBSITE} == "true" ]] && .build/deploy-site.sh - -# Clear RevAPI justifications -clear-revapi: - #!/usr/bin/env bash - jbang .build/CompatibilityUtils.java clear --version="${RELEASE_VERSION}" --do-not-clear-version-prefix="1." - if [[ $(git diff --stat) != '' ]]; then - git add -A - git status - git commit -m "chore(release): clear RevAPI breaking change justifications" - git push - else - echo "No justifications cleared" - fi diff --git a/.build/mock-events/README.md b/.build/mock-events/README.md deleted file mode 100644 index fed5ebc39..000000000 --- a/.build/mock-events/README.md +++ /dev/null @@ -1,23 +0,0 @@ -This directory contains "mock" versions of Github events to test the release process: - -The following command triggers a "dry run" of a release preparation: - -```bash -act workflow_dispatch -e .build/mock-events/release-workflow-event.json \ - -s GITHUB_API_TOKEN=${GITHUB_TOKEN} \ - -s SECRET_FILES_PASSPHRASE="..." \ - -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 \ - -r -a cescoffier -``` - -The following command triggers a tag creation event (which triggers the post-release, artifact deployment and web site update): - -```bash -act create -e .build/mock-events/tag-creation-event.json \ - -s GITHUB_API_TOKEN=${GITHUB_TOKEN} \ - -s SECRET_FILES_PASSPHRASE="..." \ - -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 \ - -r -a cescoffier -``` -**IMPORTANT:** Comment the `deploy-release.sh` line in the `deploy-release.yaml` to avoid pushing artifacts to Maven central. - diff --git a/.build/mock-events/release-workflow-event.json b/.build/mock-events/release-workflow-event.json deleted file mode 100644 index c2183f7a8..000000000 --- a/.build/mock-events/release-workflow-event.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "inputs": { - "skip-tests": true, - "dry-run": true, - "branch": "new-release-script" - } -} \ No newline at end of file diff --git a/.build/mock-events/tag-creation-event.json b/.build/mock-events/tag-creation-event.json deleted file mode 100644 index f4e9fe928..000000000 --- a/.build/mock-events/tag-creation-event.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ref": "0.12.5", - "ref_type": "tag", - "master_branch": "main" -} \ No newline at end of file diff --git a/.build/update-workshop-target-version.sh b/.build/update-workshop-target-version.sh deleted file mode 100755 index 70c1903cd..000000000 --- a/.build/update-workshop-target-version.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -./mvnw -Pupdate-workshop-examples -f workshop-examples compile -DworkshopVersion=$1 -find workshop-examples -name '*.java' | xargs chmod +x \ No newline at end of file From 38be323d53abb1058cc7659198dc838959bd4de4 Mon Sep 17 00:00:00 2001 From: Julien Ponge Date: Fri, 22 Nov 2024 18:58:06 +0100 Subject: [PATCH 2/2] docs(release): document the current release process --- RELEASING.md | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index f84ef8a1c..aadbcb91e 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,18 +1,46 @@ # Releasing Mutiny + +The release process is mostly done locally from a release branch. -## Prepare a release pull-request +## What you need -1. Make sure that all issues and pull-requests assigned to the target milestone have been closed. -2. Run: `just prepare-release 2.7.0-RC3` (replace with the correct version number). -3. Review the changes in the branch. -4. Open a pull-request: `gh pr create`. -5. Once all tests pass, merge it: - - the `pre-release.yml` workflow will create a Git tag, then - - the `release.yml` workflow will push to Maven Central, then - - the `deploy-site.yml` workflow will update the website (except for release candidates and milestones). +The `justfile` at the root of the repository contains tasks to help you in the release process. -## GitHub release notes +Make sure that the following tools are installed and properly configured: +- [GitHub CLI (gh)](https://cli.github.com/) +- [yq](https://github.com/mikefarah/yq) +- [just](https://github.com/casey/just) +- [jbang](https://www.jbang.dev/) -Run the following command: `just jreleaser 2.6.2 2.7.0-RC3` where you specify the previous and the release tags to compute release notes. +We assume that anyone doing a release already has a proper Java runtime, Git and Maven tools installed 😇 + +## Prepare a release + +Make sure that all issues and pull-requests assigned to the target milestone have been closed. + +Call `just prepare-release` with the previous and release version, as in: + +``` +$ just prepare-release 2.6.2 2.7.0-RC5 +``` + +This creates a local release branch called `release/{version}`. +- Follow the instructions to check the release notes and push the branch upstream (or else you won't be able to create a GitHub release). +- At this stage the branch is on the commit that set the release version. +- Run a quick check (`just install`) and also inspect the Git commits to make sure everything is fine. + +## Perform a release + +Once you are confident that the release can happen, run: + +``` +$ just perform-release +``` + +This creates a GitHub release and adds a few post-release commits on your release branch. +- The following GitHub Action workflows will be triggered by the new tag associated with the release: + - the website will be deployed (unless this is a pre-release) + - the Maven artifacts will be pushed to Maven Central. +- Make sure to wait for the Maven artifacts to be available on Maven Central. +- Once this is done, follow the instructions to merge the release branch, and push all your changes upstream. -If the release notes fail to update or if they are too big for JReleaser to update them, then you can read them from `target/jreleaser/release/CHANGELOG.md` and manually update the release notes on GitHub.