@@ -5,62 +5,99 @@ inputs:
5
5
required : true
6
6
type : string
7
7
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 : ' '
10
14
type : string
15
+
11
16
outputs :
12
17
destination :
13
18
description : " The destination associated with the given platform and Xcode version"
14
- value : ${{ steps.platform .outputs.destination }}
19
+ value : ${{ steps.get-destination .outputs.destination }}
15
20
sdk :
16
21
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
+
18
27
runs :
19
28
using : " composite"
20
29
steps :
21
- - id : platform
30
+ - name : Validate platform
22
31
run : |
23
- PLATFORM =${{ inputs.platform }}
24
- case $PLATFORM in
32
+ INPUT_PLATFORM =${{ inputs.platform }}
33
+ case $INPUT_PLATFORM in
25
34
iOS|tvOS|watchOS|macOS) ;;
26
- *) echo "Unsupported platform: $PLATFORM "; exit 1 ;;
35
+ *) echo "Unsupported platform: $INPUT_PLATFORM "; exit 1 ;;
27
36
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
28
43
29
- XCODE_VERSION=${{ inputs.xcode_version }}
30
- case $XCODE_VERSION in
31
- 14.0.1|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 ;;
33
53
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 }}
34
63
35
64
DESTINATION_MAPPING='{
36
- "14.0.1 ": {
65
+ "minimum ": {
37
66
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.0",
38
67
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=16.0",
39
68
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.0",
40
69
"macOS": "platform=macOS,arch=x86_64"
41
70
},
42
- "14.3 ": {
71
+ "latest ": {
43
72
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.4",
44
73
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4",
45
74
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4",
46
75
"macOS": "platform=macOS,arch=x86_64"
47
- },
48
- "15.0": {
49
- "iOS": "platform=iOS Simulator,name=iPhone 15,OS=latest",
50
- "tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest",
51
- "watchOS": "platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=latest",
52
- "macOS": "platform=macOS,arch=x86_64"
53
76
}
54
77
}'
55
78
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 }}
56
95
SDK_MAPPING='{
57
96
"iOS": "iphonesimulator",
58
97
"tvOS": "appletvsimulator",
59
98
"watchOS": "watchsimulator",
60
99
"macOS": "macosx"
61
100
}'
62
-
63
- echo "destination=$(echo $DESTINATION_MAPPING | jq -r ."\"$XCODE_VERSION\"".$PLATFORM)" >> $GITHUB_OUTPUT
64
- echo "sdk=$(echo $SDK_MAPPING | jq -r .$PLATFORM)" >> $GITHUB_OUTPUT
101
+ echo "sdk=$(echo $SDK_MAPPING | jq -r .$INPUT_PLATFORM)" >> $GITHUB_OUTPUT
65
102
shell : bash
66
103
0 commit comments