From 22e0945107732fe009b8ff229196d6b619481ccb Mon Sep 17 00:00:00 2001 From: Ed Savage Date: Tue, 7 Apr 2026 15:50:42 +1200 Subject: [PATCH 1/3] [ML] Automate version bump in CI pipeline Replace the manual block step in the version-bump pipeline with an automated step that: 1. Checks out the target branch 2. Updates elasticsearchVersion in gradle.properties to $NEW_VERSION 3. Commits as elasticsearchmachine 4. Pushes directly to the branch (no PR needed) Follows the same pattern as Elasticsearch's automated Lucene snapshot updates (.buildkite/scripts/lucene-snapshot/update-es-snapshot.sh). The Fetch DRA Artifacts step now depends on the bump step, ensuring the version is updated before polling for artifacts at the new version. Made-with: Cursor --- .buildkite/job-version-bump.json.py | 38 ++++++------------ dev-tools/bump_version.sh | 61 +++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 27 deletions(-) create mode 100755 dev-tools/bump_version.sh diff --git a/.buildkite/job-version-bump.json.py b/.buildkite/job-version-bump.json.py index a979d30bec..e8ed4c6cff 100644 --- a/.buildkite/job-version-bump.json.py +++ b/.buildkite/job-version-bump.json.py @@ -20,24 +20,23 @@ def main(): pipeline = {} - # TODO: replace the block step with version bump logic pipeline_steps = [ { - "block": "Ready to fetch for DRA artifacts?", - "prompt": ( - "Unblock when your team is ready to proceed.\n\n" - "Trigger parameters:\n" - "- NEW_VERSION: ${NEW_VERSION}\n" - "- BRANCH: ${BRANCH}\n" - "- WORKFLOW: ${WORKFLOW}\n" - ), - "key": "block-get-dra-artifacts", - "blocked_state": "running", + "label": "Bump version to ${NEW_VERSION}", + "key": "bump-version", + "agents": { + "image": "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest", + "cpu": "250m", + "memory": "512Mi", + }, + "command": [ + "dev-tools/bump_version.sh", + ], }, { "label": "Fetch DRA Artifacts", "key": "fetch-dra-artifacts", - "depends_on": "block-get-dra-artifacts", + "depends_on": "bump-version", "agents": { "image": "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest", "cpu": "250m", @@ -88,21 +87,6 @@ def main(): "(build.state == 'passed' || build.state == 'failed')" ), }, - { - "slack": { - "channels": ["#machine-learn-build"], - "message": ( - "🚦 Pipeline waiting for approval 🚦\n" - "Repo: `${REPO}`\n\n" - "Ready to fetch DRA artifacts - please unblock when ready.\n" - "New version: `${NEW_VERSION}`\n" - "Branch: `${BRANCH}`\n" - "Workflow: `${WORKFLOW}`\n" - "${BUILDKITE_BUILD_URL}\n" - ), - }, - "if": 'build.state == "blocked"', - }, ] print(json.dumps(pipeline, indent=2)) diff --git a/dev-tools/bump_version.sh b/dev-tools/bump_version.sh new file mode 100755 index 0000000000..7c3cef9c05 --- /dev/null +++ b/dev-tools/bump_version.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License +# 2.0 and the following additional limitation. Functionality enabled by the +# files subject to the Elastic License 2.0 may only be used in production when +# invoked by an Elasticsearch process with a license key installed that permits +# use of machine learning features. You may not use this file except in +# compliance with the Elastic License 2.0 and the foregoing additional +# limitation. +# +# Automated version bump script for the release-eng pipeline. +# +# Updates elasticsearchVersion in gradle.properties to $NEW_VERSION, +# commits, and pushes directly to the target branch. Designed to be +# called from a Buildkite step with NEW_VERSION and BRANCH set. +# +# Follows the same pattern as the Elasticsearch repo's automated +# Lucene snapshot updates (.buildkite/scripts/lucene-snapshot/). + +set -euo pipefail + +: "${NEW_VERSION:?NEW_VERSION must be set}" +: "${BRANCH:?BRANCH must be set}" + +GRADLE_PROPS="gradle.properties" + +# Ensure we're on the correct branch and up to date +git checkout "$BRANCH" +git pull --ff-only origin "$BRANCH" + +CURRENT_VERSION=$(grep '^elasticsearchVersion=' "$GRADLE_PROPS" | cut -d= -f2) +if [ "$CURRENT_VERSION" = "$NEW_VERSION" ]; then + echo "Version is already $NEW_VERSION — nothing to do" + exit 0 +fi + +echo "Bumping version: $CURRENT_VERSION → $NEW_VERSION" +sed -i "s/^elasticsearchVersion=.*/elasticsearchVersion=${NEW_VERSION}/" "$GRADLE_PROPS" + +# Verify the substitution worked +if ! grep -q "^elasticsearchVersion=${NEW_VERSION}$" "$GRADLE_PROPS"; then + echo "ERROR: version update verification failed" + cat "$GRADLE_PROPS" + exit 1 +fi + +# Check there's actually a diff (guards against no-op) +if git diff-index --quiet HEAD --; then + echo "No changes to commit (file unchanged after sed)" + exit 0 +fi + +git config --global user.name elasticsearchmachine +git config --global user.email 'infra-root+elasticsearchmachine@elastic.co' + +git add "$GRADLE_PROPS" +git commit -m "[ML] Bump version to ${NEW_VERSION}" +git push origin "$BRANCH" + +echo "Version bumped to ${NEW_VERSION} on branch ${BRANCH}" From 79904fc20f3c498160db295903d5e96db5fdcf1b Mon Sep 17 00:00:00 2001 From: elasticsearchmachine Date: Wed, 8 Apr 2026 15:48:49 +1200 Subject: [PATCH 2/3] [ML] Add DRY_RUN mode to version bump script Adds a DRY_RUN=true option that performs all steps (checkout, sed, commit) but skips the final git push. Useful for testing the pipeline and for local verification. Also makes sed portable across macOS/Linux and uses local git config instead of --global. Made-with: Cursor --- dev-tools/bump_version.sh | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/dev-tools/bump_version.sh b/dev-tools/bump_version.sh index 7c3cef9c05..665a0805a3 100755 --- a/dev-tools/bump_version.sh +++ b/dev-tools/bump_version.sh @@ -15,6 +15,8 @@ # commits, and pushes directly to the target branch. Designed to be # called from a Buildkite step with NEW_VERSION and BRANCH set. # +# Set DRY_RUN=true to perform all steps except the final git push. +# # Follows the same pattern as the Elasticsearch repo's automated # Lucene snapshot updates (.buildkite/scripts/lucene-snapshot/). @@ -22,9 +24,14 @@ set -euo pipefail : "${NEW_VERSION:?NEW_VERSION must be set}" : "${BRANCH:?BRANCH must be set}" +DRY_RUN="${DRY_RUN:-false}" GRADLE_PROPS="gradle.properties" +if [ "$DRY_RUN" = "true" ]; then + echo "=== DRY RUN MODE — will not push ===" +fi + # Ensure we're on the correct branch and up to date git checkout "$BRANCH" git pull --ff-only origin "$BRANCH" @@ -36,12 +43,17 @@ if [ "$CURRENT_VERSION" = "$NEW_VERSION" ]; then fi echo "Bumping version: $CURRENT_VERSION → $NEW_VERSION" -sed -i "s/^elasticsearchVersion=.*/elasticsearchVersion=${NEW_VERSION}/" "$GRADLE_PROPS" +# macOS sed requires -i '' while GNU sed requires -i without an argument +if sed --version >/dev/null 2>&1; then + sed -i "s/^elasticsearchVersion=.*/elasticsearchVersion=${NEW_VERSION}/" "$GRADLE_PROPS" +else + sed -i '' "s/^elasticsearchVersion=.*/elasticsearchVersion=${NEW_VERSION}/" "$GRADLE_PROPS" +fi # Verify the substitution worked if ! grep -q "^elasticsearchVersion=${NEW_VERSION}$" "$GRADLE_PROPS"; then echo "ERROR: version update verification failed" - cat "$GRADLE_PROPS" + grep 'elasticsearchVersion' "$GRADLE_PROPS" exit 1 fi @@ -51,11 +63,23 @@ if git diff-index --quiet HEAD --; then exit 0 fi -git config --global user.name elasticsearchmachine -git config --global user.email 'infra-root+elasticsearchmachine@elastic.co' +git config user.name elasticsearchmachine +git config user.email 'infra-root+elasticsearchmachine@elastic.co' git add "$GRADLE_PROPS" git commit -m "[ML] Bump version to ${NEW_VERSION}" -git push origin "$BRANCH" -echo "Version bumped to ${NEW_VERSION} on branch ${BRANCH}" +if [ "$DRY_RUN" = "true" ]; then + echo "" + echo "=== DRY RUN: commit created but NOT pushed ===" + echo "Branch: $BRANCH" + echo "Version: $CURRENT_VERSION → $NEW_VERSION" + echo "Commit: $(git log -1 --format='%h %s')" + echo "Author: $(git log -1 --format='%an <%ae>')" + echo "" + echo "To inspect: git log -1 -p" + echo "To undo: git reset --soft HEAD~1 && git restore --staged $GRADLE_PROPS && git checkout -- $GRADLE_PROPS" +else + git push origin "$BRANCH" + echo "Version bumped to ${NEW_VERSION} on branch ${BRANCH}" +fi From 8226e07c316b67e8b62d6ec6ceb46d278828b47e Mon Sep 17 00:00:00 2001 From: Ed Savage Date: Fri, 10 Apr 2026 15:45:21 +1200 Subject: [PATCH 3/3] [ML] Add minor version workflow to version bump automation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extends the version bump script and pipeline to support the minor release workflow (feature freeze day) in addition to patch bumps. Script changes (bump_version.sh): - Accepts WORKFLOW env var: 'patch' (default) or 'minor' - Minor workflow: creates a new minor branch from BRANCH (e.g., 9.4 from main inheriting current version), then bumps BRANCH to NEW_VERSION (the next minor) - Exports MINOR_BRANCH and MINOR_VERSION via Buildkite meta-data for downstream steps - Idempotent: skips branch creation if it already exists on remote - Refactored into reusable helpers (git_push, sed_inplace, configure_git, bump_version_on_branch) Pipeline changes (job-version-bump.json.py): - Reads WORKFLOW env var at pipeline generation time - Patch: 1 bump step + 1 DRA step (2 artifact checks) — unchanged - Minor: 1 bump step + 2 parallel DRA steps (upstream + minor branch, 4 artifact checks total covering staging + snapshot for both branches) - Minor branch name/version derived from NEW_VERSION at generation time (e.g., NEW_VERSION=9.5.0 → minor branch 9.4, version 9.4.0) - Refactored DRA step generation into helper functions Tested locally with DRY_RUN=true on a throwaway branch: - Minor workflow correctly creates branch, bumps upstream - Patch workflow backward-compatible - Unknown workflow rejected with clear error Made-with: Cursor --- .buildkite/job-version-bump.json.py | 188 +++++++++++++++++++--------- dev-tools/bump_version.sh | 182 ++++++++++++++++++++------- 2 files changed, 268 insertions(+), 102 deletions(-) diff --git a/.buildkite/job-version-bump.json.py b/.buildkite/job-version-bump.json.py index e8ed4c6cff..980acc6c95 100644 --- a/.buildkite/job-version-bump.json.py +++ b/.buildkite/job-version-bump.json.py @@ -10,22 +10,65 @@ # # This script generates JSON for the ml-cpp version bump pipeline. # It is intended to be triggered by the centralized release-eng pipeline. -# It can be integrated into existing or new workflows and includes a plugin -# that polls artifact URLs until the expected version is available. +# +# Supports two workflows via the WORKFLOW env var: +# patch (default) — bump version on BRANCH, wait for 2 artifact sets +# minor — create minor branch + bump BRANCH, wait for 3 artifact sets import contextlib import json +import os + + +WOLFI_IMAGE = "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest" +STAGING_URL = "https://artifacts-staging.elastic.co/ml-cpp/latest" +SNAPSHOT_URL = "https://storage.googleapis.com/elastic-artifacts-snapshot/ml-cpp/latest" + + +def json_watcher_plugin(url, expected_value): + return { + "elastic/json-watcher#v1.0.0": { + "url": url, + "field": ".version", + "expected_value": expected_value, + "polling_interval": "30", + } + } + + +def dra_step(label, key, depends_on, plugins): + return { + "label": label, + "key": key, + "depends_on": depends_on, + "agents": { + "image": WOLFI_IMAGE, + "cpu": "250m", + "memory": "512Mi", + "ephemeralStorage": "1Gi", + }, + "command": [ + 'echo "Waiting for DRA artifacts..."', + ], + "timeout_in_minutes": 240, + "retry": { + "automatic": [{"exit_status": "*", "limit": 2}], + "manual": {"permit_on_passed": True}, + }, + "plugins": plugins, + } def main(): - pipeline = {} + workflow = os.environ.get("WORKFLOW", "patch") + pipeline_steps = [ { "label": "Bump version to ${NEW_VERSION}", "key": "bump-version", "agents": { - "image": "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest", + "image": WOLFI_IMAGE, "cpu": "250m", "memory": "512Mi", }, @@ -33,61 +76,92 @@ def main(): "dev-tools/bump_version.sh", ], }, - { - "label": "Fetch DRA Artifacts", - "key": "fetch-dra-artifacts", - "depends_on": "bump-version", - "agents": { - "image": "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest", - "cpu": "250m", - "memory": "512Mi", - "ephemeralStorage": "1Gi", - }, - "command": [ - 'echo "Starting DRA artifacts retrieval..."', - ], - "timeout_in_minutes": 240, - "retry": { - "automatic": [ - { - "exit_status": "*", - "limit": 2, - } - ], - "manual": {"permit_on_passed": True}, - }, - "plugins": [ - { - "elastic/json-watcher#v1.0.0": { - "url": "https://artifacts-staging.elastic.co/ml-cpp/latest/${BRANCH}.json", - "field": ".version", - "expected_value": "${NEW_VERSION}", - "polling_interval": "30", - } - }, - { - "elastic/json-watcher#v1.0.0": { - "url": "https://storage.googleapis.com/elastic-artifacts-snapshot/ml-cpp/latest/${BRANCH}.json", - "field": ".version", - "expected_value": "${NEW_VERSION}-SNAPSHOT", - "polling_interval": "30", - } - }, - ], - }, ] - pipeline["steps"] = pipeline_steps - pipeline["notify"] = [ - { - "slack": {"channels": ["#machine-learn-build"]}, - "if": ( - "(build.branch == 'main' || " - "build.branch =~ /^[0-9]+\\.[0-9x]+$/) && " - "(build.state == 'passed' || build.state == 'failed')" - ), - }, - ] + if workflow == "minor": + # Minor workflow: artifact checks for both the upstream branch and the + # new minor branch, running in parallel after the bump step. + # + # Derive the minor branch from NEW_VERSION: if NEW_VERSION=9.5.0 + # then the previous minor (the new branch) is 9.4 with version 9.4.0. + new_version = os.environ.get("NEW_VERSION", "0.0.0") + parts = new_version.split(".") + if len(parts) >= 2: + major, minor_num = parts[0], int(parts[1]) + minor_branch = f"{major}.{minor_num - 1}" + minor_version = f"{major}.{minor_num - 1}.0" + else: + minor_branch = "unknown" + minor_version = "unknown" + + pipeline_steps.append( + dra_step( + label=f"Fetch DRA Artifacts (${{BRANCH}})", + key="fetch-dra-upstream", + depends_on="bump-version", + plugins=[ + json_watcher_plugin( + f"{STAGING_URL}/${{BRANCH}}.json", + "${NEW_VERSION}", + ), + json_watcher_plugin( + f"{SNAPSHOT_URL}/${{BRANCH}}.json", + "${NEW_VERSION}-SNAPSHOT", + ), + ], + ) + ) + + pipeline_steps.append( + dra_step( + label=f"Fetch DRA Artifacts ({minor_branch})", + key="fetch-dra-minor", + depends_on="bump-version", + plugins=[ + json_watcher_plugin( + f"{STAGING_URL}/{minor_branch}.json", + minor_version, + ), + json_watcher_plugin( + f"{SNAPSHOT_URL}/{minor_branch}.json", + f"{minor_version}-SNAPSHOT", + ), + ], + ) + ) + else: + # Patch workflow: staging + snapshot for BRANCH + pipeline_steps.append( + dra_step( + label="Fetch DRA Artifacts", + key="fetch-dra-artifacts", + depends_on="bump-version", + plugins=[ + json_watcher_plugin( + f"{STAGING_URL}/${{BRANCH}}.json", + "${NEW_VERSION}", + ), + json_watcher_plugin( + f"{SNAPSHOT_URL}/${{BRANCH}}.json", + "${NEW_VERSION}-SNAPSHOT", + ), + ], + ) + ) + + pipeline = { + "steps": pipeline_steps, + "notify": [ + { + "slack": {"channels": ["#machine-learn-build"]}, + "if": ( + "(build.branch == 'main' || " + "build.branch =~ /^[0-9]+\\.[0-9x]+$/) && " + "(build.state == 'passed' || build.state == 'failed')" + ), + }, + ], + } print(json.dumps(pipeline, indent=2)) diff --git a/dev-tools/bump_version.sh b/dev-tools/bump_version.sh index 665a0805a3..481e6a06d0 100755 --- a/dev-tools/bump_version.sh +++ b/dev-tools/bump_version.sh @@ -11,11 +11,18 @@ # # Automated version bump script for the release-eng pipeline. # -# Updates elasticsearchVersion in gradle.properties to $NEW_VERSION, -# commits, and pushes directly to the target branch. Designed to be -# called from a Buildkite step with NEW_VERSION and BRANCH set. +# Supports two workflows: +# WORKFLOW=patch (default) +# Updates elasticsearchVersion in gradle.properties to $NEW_VERSION +# on $BRANCH, commits, and pushes. # -# Set DRY_RUN=true to perform all steps except the final git push. +# WORKFLOW=minor +# 1. Creates a new minor branch from $BRANCH (e.g., 9.4 from main) +# inheriting the current version. +# 2. Bumps $BRANCH to $NEW_VERSION (the next minor). +# Both branches are pushed. +# +# Set DRY_RUN=true to perform all steps except git push. # # Follows the same pattern as the Elasticsearch repo's automated # Lucene snapshot updates (.buildkite/scripts/lucene-snapshot/). @@ -24,6 +31,7 @@ set -euo pipefail : "${NEW_VERSION:?NEW_VERSION must be set}" : "${BRANCH:?BRANCH must be set}" +WORKFLOW="${WORKFLOW:-patch}" DRY_RUN="${DRY_RUN:-false}" GRADLE_PROPS="gradle.properties" @@ -32,54 +40,138 @@ if [ "$DRY_RUN" = "true" ]; then echo "=== DRY RUN MODE — will not push ===" fi -# Ensure we're on the correct branch and up to date -git checkout "$BRANCH" -git pull --ff-only origin "$BRANCH" +git_push() { + local target_branch="$1" + if [ "$DRY_RUN" = "true" ]; then + echo " [DRY RUN] Would push $target_branch" + else + git push origin "$target_branch" + echo " Pushed $target_branch" + fi +} -CURRENT_VERSION=$(grep '^elasticsearchVersion=' "$GRADLE_PROPS" | cut -d= -f2) -if [ "$CURRENT_VERSION" = "$NEW_VERSION" ]; then - echo "Version is already $NEW_VERSION — nothing to do" - exit 0 -fi +sed_inplace() { + if sed --version >/dev/null 2>&1; then + sed -i "$@" + else + sed -i '' "$@" + fi +} -echo "Bumping version: $CURRENT_VERSION → $NEW_VERSION" -# macOS sed requires -i '' while GNU sed requires -i without an argument -if sed --version >/dev/null 2>&1; then - sed -i "s/^elasticsearchVersion=.*/elasticsearchVersion=${NEW_VERSION}/" "$GRADLE_PROPS" -else - sed -i '' "s/^elasticsearchVersion=.*/elasticsearchVersion=${NEW_VERSION}/" "$GRADLE_PROPS" -fi +configure_git() { + git config user.name elasticsearchmachine + git config user.email 'infra-root+elasticsearchmachine@elastic.co' +} -# Verify the substitution worked -if ! grep -q "^elasticsearchVersion=${NEW_VERSION}$" "$GRADLE_PROPS"; then - echo "ERROR: version update verification failed" - grep 'elasticsearchVersion' "$GRADLE_PROPS" - exit 1 -fi +bump_version_on_branch() { + local target_branch="$1" + local target_version="$2" -# Check there's actually a diff (guards against no-op) -if git diff-index --quiet HEAD --; then - echo "No changes to commit (file unchanged after sed)" - exit 0 -fi + git checkout "$target_branch" + git pull --ff-only origin "$target_branch" + + local current_version + current_version=$(grep '^elasticsearchVersion=' "$GRADLE_PROPS" | cut -d= -f2) + if [ "$current_version" = "$target_version" ]; then + echo "Version on $target_branch is already $target_version — nothing to do" + return 0 + fi + + echo "Bumping version on $target_branch: $current_version → $target_version" + sed_inplace "s/^elasticsearchVersion=.*/elasticsearchVersion=${target_version}/" "$GRADLE_PROPS" + + if ! grep -q "^elasticsearchVersion=${target_version}$" "$GRADLE_PROPS"; then + echo "ERROR: version update verification failed on $target_branch" + grep 'elasticsearchVersion' "$GRADLE_PROPS" + exit 1 + fi + + if git diff-index --quiet HEAD --; then + echo "No changes to commit on $target_branch (file unchanged after sed)" + return 0 + fi + + configure_git + git add "$GRADLE_PROPS" + git commit -m "[ML] Bump version to ${target_version}" + git_push "$target_branch" +} -git config user.name elasticsearchmachine -git config user.email 'infra-root+elasticsearchmachine@elastic.co' +# --------------------------------------------------------------------------- +# Patch workflow: bump version on the target branch +# --------------------------------------------------------------------------- +do_patch() { + echo "=== Patch workflow: bump $BRANCH to $NEW_VERSION ===" + bump_version_on_branch "$BRANCH" "$NEW_VERSION" +} -git add "$GRADLE_PROPS" -git commit -m "[ML] Bump version to ${NEW_VERSION}" +# --------------------------------------------------------------------------- +# Minor workflow: create minor branch, then bump upstream to next minor +# --------------------------------------------------------------------------- +do_minor() { + echo "=== Minor workflow: create minor branch from $BRANCH, then bump to $NEW_VERSION ===" + + git checkout "$BRANCH" + git pull --ff-only origin "$BRANCH" + + local current_version + current_version=$(grep '^elasticsearchVersion=' "$GRADLE_PROPS" | cut -d= -f2) + + # Derive the minor branch name from current version (e.g., 9.4.0 → 9.4) + local major minor + major=$(echo "$current_version" | cut -d. -f1) + minor=$(echo "$current_version" | cut -d. -f2) + local minor_branch="${major}.${minor}" + + echo "Current version on $BRANCH: $current_version" + echo "Minor branch to create: $minor_branch" + echo "New version for $BRANCH: $NEW_VERSION" + + # Export minor branch info for downstream Buildkite steps + if [ "${BUILDKITE:-false}" = "true" ]; then + buildkite-agent meta-data set "MINOR_BRANCH" "$minor_branch" + buildkite-agent meta-data set "MINOR_VERSION" "$current_version" + fi + export MINOR_BRANCH="$minor_branch" + export MINOR_VERSION="$current_version" + + # Check if the minor branch already exists on the remote + if git ls-remote --exit-code --heads origin "$minor_branch" >/dev/null 2>&1; then + echo "Branch $minor_branch already exists on origin — skipping creation" + else + echo "Creating branch $minor_branch from $BRANCH..." + git checkout -b "$minor_branch" + configure_git + git_push "$minor_branch" + echo "Branch $minor_branch created with version $current_version" + fi + + # Now bump the upstream branch to the new version + bump_version_on_branch "$BRANCH" "$NEW_VERSION" +} + +# --------------------------------------------------------------------------- +# Main +# --------------------------------------------------------------------------- +case "$WORKFLOW" in + patch) + do_patch + ;; + minor) + do_minor + ;; + *) + echo "ERROR: unknown WORKFLOW '$WORKFLOW' (expected 'patch' or 'minor')" + exit 1 + ;; +esac if [ "$DRY_RUN" = "true" ]; then echo "" - echo "=== DRY RUN: commit created but NOT pushed ===" - echo "Branch: $BRANCH" - echo "Version: $CURRENT_VERSION → $NEW_VERSION" - echo "Commit: $(git log -1 --format='%h %s')" - echo "Author: $(git log -1 --format='%an <%ae>')" - echo "" - echo "To inspect: git log -1 -p" - echo "To undo: git reset --soft HEAD~1 && git restore --staged $GRADLE_PROPS && git checkout -- $GRADLE_PROPS" -else - git push origin "$BRANCH" - echo "Version bumped to ${NEW_VERSION} on branch ${BRANCH}" + echo "=== DRY RUN SUMMARY ===" + echo "Workflow: $WORKFLOW" + echo "Branch: $BRANCH" + echo "Version: $NEW_VERSION" + echo "Recent commits:" + git log --oneline -3 fi