Skip to content

Commit 07431bc

Browse files
spboltonclaude
andcommitted
fix(ci): install Homebrew bash for SDKMAN on macOS runners #35004
SDKMAN 5.21+ requires Bash 4+ but macOS runners ship Bash 3.2. The previous zsh workaround failed because SDKMAN's installer uses bashisms throughout (confirmed by SDKMAN team in sdkman-cli#1520). Install Homebrew bash on macOS before running the SDKMAN installer. Only runs on cache miss. Stopgap until mise replaces SDKMAN. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9c9af79 commit 07431bc

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

.github/actions/core-cicd/setup-java/action.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,29 @@ runs:
6161
with:
6262
path: ~/.sdkman
6363
key: ${{ runner.os }}-${{ env.ARCHITECTURE }}-sdkman-install
64+
- name: Install Bash 4+ (macOS)
65+
if: ${{ steps.restore-cache-sdkman.outputs.cache-hit != 'true' && runner.os == 'macOS' }}
66+
shell: bash
67+
run: |
68+
# macOS ships Bash 3.2 but SDKMAN 5.21+ requires Bash 4+.
69+
# Homebrew is pre-installed on GitHub macOS runners.
70+
brew install bash
71+
echo "Installed Bash: $($(brew --prefix)/bin/bash --version | head -1)"
6472
- name: Install SDKMan
6573
id: install-sdkman
6674
if: ${{ steps.restore-cache-sdkman.outputs.cache-hit != 'true' }}
6775
shell: bash
6876
run: |
6977
if [ ! -f "$HOME/.sdkman/bin/sdkman-init.sh" ]; then
70-
echo "Downloading SDKMAN install"
71-
curl -s "https://get.sdkman.io" | bash
78+
echo "Downloading SDKMAN install"
79+
# Use Homebrew bash on macOS (Bash 4+), system bash on Linux (already 5.x)
80+
if [[ "$RUNNER_OS" == "macOS" ]]; then
81+
BREW_BASH="$(brew --prefix)/bin/bash"
82+
echo "Using Homebrew bash: $($BREW_BASH --version | head -1)"
83+
curl -s "https://get.sdkman.io" | "$BREW_BASH"
84+
else
85+
curl -s "https://get.sdkman.io" | bash
86+
fi
7287
fi
7388
- name: Save Cache SDKMan install
7489
id: save-cache-sdkman

0 commit comments

Comments
 (0)