-
Notifications
You must be signed in to change notification settings - Fork 236
Expand file tree
/
Copy pathaction.yml
More file actions
149 lines (137 loc) · 4.85 KB
/
Copy pathaction.yml
File metadata and controls
149 lines (137 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: 'Get the build parameters for a given platform'
inputs:
platform:
description: 'The name of the platform. Valid values are iOS, tvOS, watchOS and macOS'
required: true
type: string
xcode_version:
description: "The version of Xcode. Available aliases are 'latest' and 'minimum'"
default: 'latest'
type: string
destination:
description: "The destination associated with the given platform and Xcode version"
default: ''
type: string
outputs:
destination:
description: "The destination associated with the given platform and Xcode version"
value: ${{ steps.get-destination.outputs.destination }}
device:
description: "The device name used in the destination"
value: ${{ steps.get-destination.outputs.device }}
sdk:
description: "The SDK associated with the given platform"
value: ${{ steps.get-sdk.outputs.sdk }}
xcode-version:
description: "The Xcode version to build with"
value: ${{ steps.get-xcode-version.outputs.xcode-version }}
runs:
using: "composite"
steps:
- name: Validate platform
run: |
INPUT_PLATFORM=${{ inputs.platform }}
case $INPUT_PLATFORM in
iOS|tvOS|watchOS|macOS|visionOS) ;;
*) echo "Unsupported platform: $INPUT_PLATFORM"; exit 1 ;;
esac
shell: bash
- id: get-xcode-version
run: |
LATEST_XCODE_VERSION=26.5
MINIMUM_XCODE_VERSION=26.0.1
INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
case $INPUT_XCODE_VERSION in
latest)
XCODE_VERSION=$LATEST_XCODE_VERSION ;;
minimum)
XCODE_VERSION=$MINIMUM_XCODE_VERSION ;;
*)
XCODE_VERSION=$INPUT_XCODE_VERSION ;;
esac
echo "xcode-version=$XCODE_VERSION" >> $GITHUB_OUTPUT
shell: bash
- id: get-destination
run: |
INPUT_PLATFORM=${{ inputs.platform }}
INPUT_DESTINATION='${{ inputs.destination }}'
XCODE_VERSION=${{ steps.get-xcode-version.outputs.xcode-version }}
# Map resolved Xcode versions to simulator destinations.
# Only explicitly supported versions are allowed — unknown versions fail.
#
# The minimum-Xcode legs (26.0.1) run against the 26.2 simulator runtime:
# the macos-26 runner image ships SDKs for 26.0 but only installs runtimes
# for 26.2 and later. The Xcode version is what we are validating here, and
# the runtime only needs to be at or above our deployment target floors.
case $INPUT_PLATFORM/$XCODE_VERSION in
iOS/26.5)
DEVICE="iPhone 17 Pro Max"
OS_VERSION="26.5"
;;
iOS/26.0.1)
DEVICE="iPhone 17 Pro Max"
OS_VERSION="26.2"
;;
tvOS/26.5)
DEVICE="Apple TV 4K (3rd generation)"
OS_VERSION="26.5"
;;
tvOS/26.0.1)
DEVICE="Apple TV 4K (3rd generation)"
OS_VERSION="26.2"
;;
watchOS/26.5)
DEVICE="Apple Watch Series 11 (46mm)"
OS_VERSION="26.5"
;;
watchOS/26.0.1)
DEVICE="Apple Watch Series 11 (46mm)"
OS_VERSION="26.2"
;;
visionOS/26.5)
DEVICE="Apple Vision Pro"
OS_VERSION="26.5"
;;
visionOS/26.0.1)
DEVICE="Apple Vision Pro"
OS_VERSION="26.2"
;;
macOS/*)
;;
*)
echo "Unsupported platform/Xcode combination: $INPUT_PLATFORM/$XCODE_VERSION"
echo "Supported Xcode versions: 26.5, 26.0.1"
exit 1
;;
esac
DESTINATION_MAPPING="{
\"iOS\": \"platform=iOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"tvOS\": \"platform=tvOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"watchOS\": \"platform=watchOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"visionOS\": \"platform=visionOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"macOS\": \"platform=macOS,arch=arm64\"
}"
if [ -z "$INPUT_DESTINATION" ]; then
DESTINATION=$(echo $DESTINATION_MAPPING | jq -r ".$INPUT_PLATFORM")
else
DESTINATION=$INPUT_DESTINATION
fi
if [ -z "$DESTINATION" ]; then
echo "No available destination to build for"
exit 1
fi
echo "destination=$DESTINATION" >> $GITHUB_OUTPUT
echo "device=$DEVICE" >> $GITHUB_OUTPUT
shell: bash
- id: get-sdk
run: |
INPUT_PLATFORM=${{ inputs.platform }}
SDK_MAPPING='{
"iOS": "iphonesimulator",
"tvOS": "appletvsimulator",
"watchOS": "watchsimulator",
"visionOS": "xrsimulator",
"macOS": "macosx"
}'
echo "sdk=$(echo $SDK_MAPPING | jq -r .$INPUT_PLATFORM)" >> $GITHUB_OUTPUT
shell: bash