@@ -5,56 +5,99 @@ inputs:
55 required : true
66 type : string
77 xcode_version :
8- description : ' The version of Xcode. Valid values are 14.3 and 15.0'
9- required : true
8+ description : " The version of Xcode. Available aliases are 'latest' and 'minimum'"
9+ default : ' latest'
10+ type : string
11+ destination :
12+ description : " The destination associated with the given platform and Xcode version"
13+ default : ' '
1014 type : string
15+
1116outputs :
1217 destination :
1318 description : " The destination associated with the given platform and Xcode version"
14- value : ${{ steps.platform .outputs.destination }}
19+ value : ${{ steps.get-destination .outputs.destination }}
1520 sdk :
1621 description : " The SDK associated with the given platform"
17- value : ${{ steps.platform.outputs.sdk }}
22+ value : ${{ steps.get-sdk.outputs.sdk }}
23+ xcode-version :
24+ description : " The Xcode version to build with"
25+ value : ${{ steps.get-xcode-version.outputs.xcode-version }}
26+
1827runs :
1928 using : " composite"
2029 steps :
21- - id : platform
30+ - name : Validate platform
2231 run : |
23- PLATFORM =${{ inputs.platform }}
24- case $PLATFORM in
32+ INPUT_PLATFORM =${{ inputs.platform }}
33+ case $INPUT_PLATFORM in
2534 iOS|tvOS|watchOS|macOS) ;;
26- *) echo "Unsupported platform: $PLATFORM "; exit 1 ;;
35+ *) echo "Unsupported platform: $INPUT_PLATFORM "; exit 1 ;;
2736 esac
37+ shell : bash
38+
39+ - id : get-xcode-version
40+ run : |
41+ LATEST_XCODE_VERSION=14.3.1
42+ MINIMUM_XCODE_VERSION=14.0.1
2843
29- XCODE_VERSION=${{ inputs.xcode_version }}
30- case $XCODE_VERSION in
31- 14.3|15.0) ;;
32- *) echo "Unsupported Xcode version: $XCODE_VERSION"; exit 1 ;;
44+ INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
45+
46+ case $INPUT_XCODE_VERSION in
47+ latest)
48+ XCODE_VERSION=$LATEST_XCODE_VERSION ;;
49+ minimum)
50+ XCODE_VERSION=$MINIMUM_XCODE_VERSION ;;
51+ *)
52+ XCODE_VERSION=$INPUT_XCODE_VERSION ;;
3353 esac
54+ echo "xcode-version=$XCODE_VERSION" >> $GITHUB_OUTPUT
55+
56+ shell : bash
57+
58+ - id : get-destination
59+ run : |
60+ INPUT_PLATFORM=${{ inputs.platform }}
61+ INPUT_DESTINATION='${{ inputs.destination }}'
62+ INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
3463
3564 DESTINATION_MAPPING='{
36- "14.3": {
65+ "minimum": {
66+ "iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.0",
67+ "tvOS": "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=16.0",
68+ "watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.0",
69+ "macOS": "platform=macOS,arch=x86_64"
70+ },
71+ "latest": {
3772 "iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.4",
3873 "tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4",
3974 "watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4",
4075 "macOS": "platform=macOS,arch=x86_64"
41- },
42- "15.0": {
43- "iOS": "platform=iOS Simulator,name=iPhone 15,OS=latest",
44- "tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest",
45- "watchOS": "platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=latest",
46- "macOS": "platform=macOS,arch=x86_64"
4776 }
4877 }'
4978
79+ if [ -z "$INPUT_DESTINATION" ]; then
80+ DESTINATION=$(echo $DESTINATION_MAPPING | jq -r ".\"$INPUT_XCODE_VERSION\".$INPUT_PLATFORM")
81+ else
82+ DESTINATION=$INPUT_DESTINATION
83+ fi
84+
85+ if [ -z "$DESTINATION" ]; then
86+ echo "No available destination to build for"
87+ exit 1
88+ fi
89+ echo "destination=$DESTINATION" >> $GITHUB_OUTPUT
90+ shell : bash
91+
92+ - id : get-sdk
93+ run : |
94+ INPUT_PLATFORM=${{ inputs.platform }}
5095 SDK_MAPPING='{
5196 "iOS": "iphonesimulator",
5297 "tvOS": "appletvsimulator",
5398 "watchOS": "watchsimulator",
5499 "macOS": "macosx"
55100 }'
56-
57- echo "destination=$(echo $DESTINATION_MAPPING | jq -r ."\"$XCODE_VERSION\"".$PLATFORM)" >> $GITHUB_OUTPUT
58- echo "sdk=$(echo $SDK_MAPPING | jq -r .$PLATFORM)" >> $GITHUB_OUTPUT
101+ echo "sdk=$(echo $SDK_MAPPING | jq -r .$INPUT_PLATFORM)" >> $GITHUB_OUTPUT
59102 shell : bash
60103
0 commit comments