From 6c08df857b21a3285f817cae695a1b1986ff0c3e Mon Sep 17 00:00:00 2001 From: Bruno Borges Date: Tue, 14 Jul 2026 17:29:54 -0400 Subject: [PATCH] Fix portable settings hash in workflow Use a cross-platform SHA-256 helper for settings.xml snapshots so the stacked-distributions workflow works under Windows git-bash, where shasum is not available. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/multiple-distributions.yml | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/multiple-distributions.yml b/.github/workflows/multiple-distributions.yml index 8be1d00..6723de9 100644 --- a/.github/workflows/multiple-distributions.yml +++ b/.github/workflows/multiple-distributions.yml @@ -102,8 +102,20 @@ jobs: test -f "$SETTINGS" || { echo "::error::first step did not create settings.xml"; exit 1; } echo "settings.xml after first step:" cat "$SETTINGS" + sha256_file() { + if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$1" | awk '{print $1}' + elif command -v shasum >/dev/null 2>&1; then + shasum -a 256 "$1" | awk '{print $1}' + elif command -v openssl >/dev/null 2>&1; then + openssl dgst -sha256 "$1" | awk '{print $NF}' + else + echo "::error::no SHA-256 command found (tried sha256sum, shasum, openssl)" >&2 + return 1 + fi + } # Snapshot the exact bytes so we can prove the next step leaves it untouched. - HASH=$(shasum -a 256 "$SETTINGS" | awk '{print $1}') + HASH=$(sha256_file "$SETTINGS") echo "SETTINGS_HASH_BEFORE=$HASH" >> "$GITHUB_ENV" echo "settings.xml sha256 (before second step): $HASH" @@ -140,6 +152,18 @@ jobs: echo "----" count_tag() { grep -o "$1" "$TC" | wc -l | tr -d '[:space:]'; } + sha256_file() { + if command -v sha256sum >/dev/null 2>&1; then + sha256sum "$1" | awk '{print $1}' + elif command -v shasum >/dev/null 2>&1; then + shasum -a 256 "$1" | awk '{print $1}' + elif command -v openssl >/dev/null 2>&1; then + openssl dgst -sha256 "$1" | awk '{print $NF}' + else + echo "::error::no SHA-256 command found (tried sha256sum, shasum, openssl)" >&2 + return 1 + fi + } # 1) Exactly one root, containing exactly the two stacked JDKs. ROOT=$(count_tag "