From d5658eeb9e2e5643f4e746d1682ac19d6cd5651c Mon Sep 17 00:00:00 2001 From: sravan Date: Fri, 24 Jul 2026 15:40:01 +0530 Subject: [PATCH] ci: surface the real xcodebuild error on archive failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The archive keeps failing with only "Failed to archive" and exit 65 — no reason shown. Cause: `xcode-project build-ipa` prints a prettified summary and swallows xcodebuild's raw "error:" lines, which only survive in the /tmp/xcodebuild_logs artifact. On failure we now grep that log for the signing/entitlement/compile error and print it inline, so the next red build states WHY instead of just 65. Co-Authored-By: Claude Opus 4.8 --- codemagic.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index 6ffd1b0..d44b10f 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -101,9 +101,15 @@ workflows: # then archive. use-profiles scans for **/*.xcodeproj under the repo root and sets manual # signing (team + profile specifier) on the matching App target. xcode-project use-profiles - xcode-project build-ipa \ - --workspace "$XCODE_WORKSPACE" \ - --scheme "$XCODE_SCHEME" + # `xcode-project build-ipa` prints a PRETTIFIED summary and swallows the raw xcodebuild "error:" + # lines — a failed archive shows only "Failed to archive" with no reason. On failure, surface the + # actual errors from the raw log so we don't have to dig through the artifact. + if ! xcode-project build-ipa --workspace "$XCODE_WORKSPACE" --scheme "$XCODE_SCHEME"; then + echo "======================= xcodebuild errors =======================" + grep -h -E "error:|errSec|Provisioning profile|entitlement|Code ?Sign|does not (support|contain)|requires a provisioning|No profile|No signing|doesn't (include|match)|Command .* failed" /tmp/xcodebuild_logs/*.log 2>/dev/null | grep -vi "warning:" | tail -60 || echo "(no matching lines — open the xcodebuild_logs artifact)" + echo "=================================================================" + exit 1 + fi artifacts: - build/ios/ipa/*.ipa - /tmp/xcodebuild_logs/*.log