Skip to content

Commit ccb5dad

Browse files
committed
Update build.yml
1 parent a1dc19c commit ccb5dad

1 file changed

Lines changed: 28 additions & 19 deletions

File tree

.github/workflows/build.yml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,39 @@ jobs:
2828
run: |
2929
set -euo pipefail
3030
31-
# 설치된 iOS Simulator 런타임 버전들 추출 (예: 17.2, 18.0 ...)
32-
# 출력 포맷이 달라질 수 있어, "iOS <version>" 패턴에서 숫자만 뽑습니다.
33-
versions=()
34-
while IFS= read -r v; do
35-
versions+=("$v")
36-
done < <(
37-
xcrun simctl runtime list 2>/dev/null \
38-
| grep -Eo 'iOS ([0-9]+(\.[0-9]+)*)' \
39-
| awk '{print $2}' \
40-
| sort -V \
41-
| uniq
31+
# iPhone 시뮬레이터가 존재하는 런타임 중 가장 낮은 버전 선택
32+
chosen=$(python3 - <<'PY'
33+
import json, subprocess
34+
35+
data = subprocess.check_output(["xcrun", "simctl", "list", "devices", "available", "-j"], text=True)
36+
j = json.loads(data)
37+
38+
versions = []
39+
for runtime, devices in j.get("devices", {}).items():
40+
if "iOS-" not in runtime:
41+
continue
42+
# iPhone 디바이스가 있는 런타임만
43+
if not any(d.get("isAvailable") and "iPhone" in d.get("name", "") for d in devices):
44+
continue
45+
ver = runtime.split("iOS-")[-1].replace("-", ".")
46+
versions.append(ver)
47+
48+
def ver_key(v):
49+
return [int(x) for x in v.split(".")]
50+
51+
versions = sorted(set(versions), key=ver_key)
52+
if not versions:
53+
raise SystemExit(1)
54+
print(versions[0])
55+
PY
4256
)
4357
44-
if [ "${#versions[@]}" -eq 0 ]; then
45-
echo "No iOS simulator runtimes detected." >&2
58+
if [ -z "${chosen:-}" ]; then
59+
echo "No iPhone simulator runtimes detected." >&2
4660
exit 1
4761
fi
4862
49-
# 실제 존재하는 런타임 중 가장 낮은 버전 선택
50-
MIN_IOS="${versions[0]}"
51-
chosen="$MIN_IOS"
52-
53-
echo "Detected runtimes: ${versions[*]:-<none>}"
54-
echo "Chosen iOS runtime version: $chosen"
63+
echo "Chosen iOS runtime version (iPhone): $chosen"
5564
5665
echo "ios_version=$chosen" >> "$GITHUB_OUTPUT"
5766

0 commit comments

Comments
 (0)