11name : Select Xcode with Swift 6.2+
22description : >
3- Select the newest Xcode 26+ install on the runner so a swift-tools-version
3+ Select an installed Xcode 26+ on the runner so a swift-tools-version
44 6.2 Package.swift resolves. macos-latest currently defaults to Xcode 16.4,
55 which ships Swift 6.1.0 and rejects 6.2 manifests with
66 "is using Swift tools version 6.2.0 but the installed version is 6.1.0".
7+ By default picks the newest installed Xcode 26+; pass `version` to pin
8+ a specific major.minor (e.g. `26.3`) for matrix coverage.
79
810# TODO: remove this action and every `- uses: ./.github/actions/select-xcode`
911# call site once GitHub's macos-latest image defaults to an Xcode that ships
@@ -12,15 +14,25 @@ description: >
1214# (look for "(default)" in the Xcode table). When the default version meets
1315# the package's swift-tools-version, the explicit selection becomes redundant.
1416
17+ inputs :
18+ version :
19+ description : >
20+ Xcode version glob to match (e.g. "26.3" matches Xcode_26.3*.app).
21+ Defaults to "26", which picks the newest Xcode 26+ installed.
22+ required : false
23+ default : " 26"
24+
1525runs :
1626 using : composite
1727 steps :
1828 - shell : bash
29+ env :
30+ XCODE_VERSION : ${{ inputs.version }}
1931 run : |
2032 set -euo pipefail
21- xcode=$(ls -d /Applications/Xcode_26 *.app 2>/dev/null | sort -V | tail -1)
33+ xcode=$(ls -d /Applications/Xcode_${XCODE_VERSION} *.app 2>/dev/null | sort -V | tail -1)
2234 if [[ -z "$xcode" ]]; then
23- echo "No Xcode 26+ installed on this runner image." >&2
35+ echo "No Xcode matching /Applications/Xcode_${XCODE_VERSION}*.app installed on this runner image." >&2
2436 ls /Applications | grep -i xcode >&2 || true
2537 exit 1
2638 fi
0 commit comments