Skip to content

Commit faf1e7e

Browse files
committed
Set up xcode properly
1 parent ffab8a4 commit faf1e7e

File tree

3 files changed

+40
-8
lines changed

3 files changed

+40
-8
lines changed

.github/workflows/Build.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,28 @@ jobs:
1515
uses: actions/setup-dotnet@v5
1616
with:
1717
dotnet-version: '10.x'
18-
- if: matrix.os == 'macos-latest'
18+
- name: Query required Xcode version
19+
if: matrix.os == 'macos-latest'
20+
id: xcode-version
21+
run: |
22+
# Get the MacCatalyst SDK version from dotnet workload
23+
MACCATALYST_VERSION=$(dotnet workload list --verbosity detailed 2>&1 | grep -A 5 "maui-maccatalyst" | grep "Microsoft.MacCatalyst.Sdk" | sed -n 's/.*Microsoft.MacCatalyst.Sdk.net[0-9.]*_\([0-9.]*\).*/\1/p' | head -1)
24+
25+
if [ -z "$MACCATALYST_VERSION" ]; then
26+
echo "Could not determine MacCatalyst SDK version, using latest-stable Xcode"
27+
echo "xcode-version=latest-stable" >> $GITHUB_OUTPUT
28+
else
29+
# Extract major.minor version (e.g., 26.2 from 26.2.10191)
30+
XCODE_VERSION=$(echo $MACCATALYST_VERSION | cut -d. -f1-2)
31+
echo "Required Xcode version: $XCODE_VERSION"
32+
echo "xcode-version=$XCODE_VERSION" >> $GITHUB_OUTPUT
33+
fi
34+
shell: bash
35+
- name: Setup Xcode
36+
if: matrix.os == 'macos-latest'
1937
uses: maxim-lobanov/setup-xcode@v1
2038
with:
21-
xcode-version: latest-stable
39+
xcode-version: ${{ steps.xcode-version.outputs.xcode-version }}
2240
- name: .NET Workload restore
2341
run: dotnet workload restore
2442
- name: Restore NuGet Packages

.github/workflows/Release.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ jobs:
1414
uses: actions/setup-dotnet@v5
1515
with:
1616
dotnet-version: '10.x'
17-
- if: matrix.os == 'macos-latest'
18-
uses: maxim-lobanov/setup-xcode@v1
19-
with:
20-
xcode-version: latest-stable
2117
- name: Build GitHub Releases draft artifacts
2218
env:
2319
RELEASE_NOTES: |

.github/workflows/Test.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,28 @@ jobs:
1515
uses: actions/setup-dotnet@v5
1616
with:
1717
dotnet-version: '10.x'
18-
- if: matrix.os == 'macos-latest'
18+
- name: Query required Xcode version
19+
if: matrix.os == 'macos-latest'
20+
id: xcode-version
21+
run: |
22+
# Get the MacCatalyst SDK version from dotnet workload
23+
MACCATALYST_VERSION=$(dotnet workload list --verbosity detailed 2>&1 | grep -A 5 "maui-maccatalyst" | grep "Microsoft.MacCatalyst.Sdk" | sed -n 's/.*Microsoft.MacCatalyst.Sdk.net[0-9.]*_\([0-9.]*\).*/\1/p' | head -1)
24+
25+
if [ -z "$MACCATALYST_VERSION" ]; then
26+
echo "Could not determine MacCatalyst SDK version, using latest-stable Xcode"
27+
echo "xcode-version=latest-stable" >> $GITHUB_OUTPUT
28+
else
29+
# Extract major.minor version (e.g., 26.2 from 26.2.10191)
30+
XCODE_VERSION=$(echo $MACCATALYST_VERSION | cut -d. -f1-2)
31+
echo "Required Xcode version: $XCODE_VERSION"
32+
echo "xcode-version=$XCODE_VERSION" >> $GITHUB_OUTPUT
33+
fi
34+
shell: bash
35+
- name: Setup Xcode
36+
if: matrix.os == 'macos-latest'
1937
uses: maxim-lobanov/setup-xcode@v1
2038
with:
21-
xcode-version: latest-stable
39+
xcode-version: ${{ steps.xcode-version.outputs.xcode-version }}
2240
- name: Build and Test
2341
run: |
2442
dotnet workload restore

0 commit comments

Comments
 (0)