Skip to content

Commit 1a249a1

Browse files
committed
fix xcode selection bash compatibility
1 parent 4073d94 commit 1a249a1

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

.github/workflows/electron-release.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,11 @@ jobs:
275275
shell: bash
276276
run: |
277277
set -euo pipefail
278-
mapfile -t XCODE_APPS < <(find /Applications -maxdepth 1 -type d \( -name 'Xcode_26*.app' -o -name 'Xcode-26*.app' \) | sort -V)
279-
if [[ ${#XCODE_APPS[@]} -eq 0 && -d /Applications/Xcode.app ]]; then
280-
XCODE_APPS=(/Applications/Xcode.app)
278+
XCODE_APP="$(find /Applications -maxdepth 1 -type d \( -name 'Xcode_26*.app' -o -name 'Xcode-26*.app' \) | sort | tail -n 1)"
279+
if [[ -z "$XCODE_APP" && -d /Applications/Xcode.app ]]; then
280+
XCODE_APP="/Applications/Xcode.app"
281281
fi
282-
[[ ${#XCODE_APPS[@]} -gt 0 ]] || { echo "No Xcode 26 installation found under /Applications"; exit 1; }
283-
XCODE_APP="${XCODE_APPS[-1]}"
282+
[[ -n "$XCODE_APP" ]] || { echo "No Xcode 26 installation found under /Applications"; exit 1; }
284283
sudo xcode-select -s "$XCODE_APP/Contents/Developer"
285284
XCODE_VERSION="$(xcodebuild -version | awk 'NR==1 {print $2}')"
286285
[[ "$XCODE_VERSION" == 26.* ]] || { echo "Expected Xcode 26.x but found $XCODE_VERSION"; exit 1; }
@@ -444,12 +443,11 @@ jobs:
444443
shell: bash
445444
run: |
446445
set -euo pipefail
447-
mapfile -t XCODE_APPS < <(find /Applications -maxdepth 1 -type d \( -name 'Xcode_26*.app' -o -name 'Xcode-26*.app' \) | sort -V)
448-
if [[ ${#XCODE_APPS[@]} -eq 0 && -d /Applications/Xcode.app ]]; then
449-
XCODE_APPS=(/Applications/Xcode.app)
446+
XCODE_APP="$(find /Applications -maxdepth 1 -type d \( -name 'Xcode_26*.app' -o -name 'Xcode-26*.app' \) | sort | tail -n 1)"
447+
if [[ -z "$XCODE_APP" && -d /Applications/Xcode.app ]]; then
448+
XCODE_APP="/Applications/Xcode.app"
450449
fi
451-
[[ ${#XCODE_APPS[@]} -gt 0 ]] || { echo "No Xcode 26 installation found under /Applications"; exit 1; }
452-
XCODE_APP="${XCODE_APPS[-1]}"
450+
[[ -n "$XCODE_APP" ]] || { echo "No Xcode 26 installation found under /Applications"; exit 1; }
453451
sudo xcode-select -s "$XCODE_APP/Contents/Developer"
454452
XCODE_VERSION="$(xcodebuild -version | awk 'NR==1 {print $2}')"
455453
[[ "$XCODE_VERSION" == 26.* ]] || { echo "Expected Xcode 26.x but found $XCODE_VERSION"; exit 1; }

0 commit comments

Comments
 (0)