fix(ci): wrap deploy commands in if blocks for -e protection
Some checks failed
CI / Detect Changes (pull_request) Successful in 3s
CI / Admin Web CI (pull_request) Has been skipped
CI / YouTube Worker (pull_request) Has been skipped
PR → Build → WiFi/USB Deploy → LGTM / Build & Deploy to iPhone (WiFi/USB) (pull_request) Failing after 4m12s
PR → Build → WiFi/USB Deploy → LGTM / Wait for LGTM comment (pull_request) Has been skipped
CI / Deploy (pull_request) Has been skipped
Some checks failed
CI / Detect Changes (pull_request) Successful in 3s
CI / Admin Web CI (pull_request) Has been skipped
CI / YouTube Worker (pull_request) Has been skipped
PR → Build → WiFi/USB Deploy → LGTM / Build & Deploy to iPhone (WiFi/USB) (pull_request) Failing after 4m12s
PR → Build → WiFi/USB Deploy → LGTM / Wait for LGTM comment (pull_request) Has been skipped
CI / Deploy (pull_request) Has been skipped
Bash -e doesn't just kill on pipefail — it exits on ANY non-zero command. Even without a pipeline, both xcrun devicectl and ios-deploy return non-zero on failure, killing the script before the exit-code check. Fix: wrap both in 'if command; then exit 0; fi' so -e treats them as condition-tested (no early exit). Fallback now actually runs.
This commit is contained in:
10
.github/workflows/pr-iphone-deploy.yml
vendored
10
.github/workflows/pr-iphone-deploy.yml
vendored
@@ -106,18 +106,15 @@ jobs:
|
||||
|
||||
# 1. Try WiFi first (Xcode 15+ devicectl network discovery)
|
||||
echo "📱 Trying WiFi install via devicectl..."
|
||||
xcrun devicectl device install app --device "$UDID" "$APP" > /tmp/devicectl.log 2>&1
|
||||
DEVICECTL_EXIT=$?
|
||||
tail -10 /tmp/devicectl.log
|
||||
if [ $DEVICECTL_EXIT -eq 0 ]; then
|
||||
if xcrun devicectl device install app --device "$UDID" "$APP" > /tmp/devicectl.log 2>&1; then
|
||||
echo "✅ Installed via WiFi"
|
||||
exit 0
|
||||
fi
|
||||
tail -10 /tmp/devicectl.log
|
||||
|
||||
# 2. Fallback to USB via ios-deploy
|
||||
echo "🔌 WiFi failed, trying USB..."
|
||||
ios-deploy --bundle "$APP" --id "$UDID" --justlaunch
|
||||
if [ $? -eq 0 ]; then
|
||||
if ios-deploy --bundle "$APP" --id "$UDID" --justlaunch; then
|
||||
echo "✅ Installed via USB"
|
||||
exit 0
|
||||
fi
|
||||
@@ -125,6 +122,7 @@ jobs:
|
||||
echo "❌ Install failed (both WiFi and USB)"
|
||||
exit 1
|
||||
|
||||
|
||||
- name: Post "Ready to test" comment
|
||||
env:
|
||||
GT_TOKEN: ${{ secrets.PR_API_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user