Skip to content

Commit fbfb5d2

Browse files
committed
Update build.yml
1 parent 5b8d384 commit fbfb5d2

1 file changed

Lines changed: 31 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,37 @@ jobs:
2929
set -euo pipefail
3030
3131
# simctl 텍스트 헤더 버전 기준으로 최신 iOS 버전의 iPhone 선택
32-
RESULT=$(xcrun simctl list devices | awk '
33-
/^== iOS / {ver=$3; next}
34-
/\(unavailable\)/ {next}
35-
ver && $0 ~ /iPhone/ {
36-
line=$0
37-
sub(/^[[:space:]]+/, "", line)
38-
sub(/ \(.*/, "", line)
39-
print ver "|" line
40-
}
41-
' | sort -t'|' -k1,1Vr | head -n 1)
32+
RESULT=$(python3 - <<'PY'
33+
import re, subprocess, sys
34+
35+
text = subprocess.check_output(["xcrun", "simctl", "list", "devices"], text=True)
36+
37+
current_ver = None
38+
candidates = [] # (version_tuple, version_str, device_name)
39+
40+
def ver_key(v):
41+
return tuple(int(x) for x in v.split('.'))
42+
43+
for line in text.splitlines():
44+
m = re.match(r"^== iOS ([0-9]+(?:\.[0-9]+)*) ==$", line.strip())
45+
if m:
46+
current_ver = m.group(1)
47+
continue
48+
if "(unavailable)" in line:
49+
continue
50+
if current_ver and "iPhone" in line:
51+
name = line.strip()
52+
name = re.sub(r" \(.*", "", name)
53+
candidates.append((ver_key(current_ver), current_ver, name))
54+
55+
if not candidates:
56+
sys.exit(1)
57+
58+
candidates.sort(reverse=True)
59+
_, ver, name = candidates[0]
60+
print(f"{ver}|{name}")
61+
PY
62+
)
4263
4364
if [ -z "${RESULT:-}" ]; then
4465
echo "No iPhone simulator devices detected." >&2

0 commit comments

Comments
 (0)