Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 0727f73

Browse files
authored
Refactor Xcode project generation step
Removed redundant comments and improved clarity in the Xcode project generation step.
1 parent 045f8b0 commit 0727f73

File tree

1 file changed

+4
-91
lines changed

1 file changed

+4
-91
lines changed

.github/workflows/build-unsigned-ipa.yml

Lines changed: 4 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -90,100 +90,13 @@ jobs:
9090
echo "project.yml (first 200 lines):"
9191
sed -n '1,200p' project.yml || true
9292
93-
- name: Generate Xcode Project (force local build + override Homebrew bottle)
94-
shell: /bin/bash {0}
93+
- name: Generate Xcode Project
9594
run: |
96-
set -euo pipefail
97-
98-
echo "=== diagnostics: PATH + which xcodegen ==="
99-
echo "PATH=$PATH"
100-
which xcodegen || true
101-
xcodegen --version 2>/dev/null || true
102-
if command -v xcodegen >/dev/null 2>&1; then
103-
echo "xcodegen binary:"
104-
file "$(command -v xcodegen)" || true
105-
spctl --assess -vv "$(command -v xcodegen)" 2>&1 || true
106-
xattr -l "$(command -v xcodegen)" 2>/dev/null || true
107-
fi
108-
109-
echo "=== Attempt fast path: run preinstalled xcodegen ==="
110-
set +e
111-
xcodegen generate --spec project.yml
112-
rc=$?
11395
set -e
114-
115-
if [ $rc -eq 0 ]; then
116-
echo "✅ Fast path succeeded (preinstalled xcodegen)."
117-
sed -n '1,60p' prostore.xcodeproj/project.pbxproj || true
118-
exit 0
119-
fi
120-
121-
echo "⚠️ Fast path failed (rc=$rc). Checking for AMFI/CT issues..."
122-
123-
# show kernel/AMFI lines for quick signal
124-
echo "---- recent AMFI / kernel messages (best-effort) ----"
125-
log show --style syslog --last 5m 2>/dev/null | egrep -i "AMFI|CodeSigning|CT|xcodegen" || true
126-
127-
# If Homebrew xcodegen is present, aggressively remove it to avoid re-using the bottle
128-
if command -v brew >/dev/null 2>&1 && command -v xcodegen >/dev/null 2>&1; then
129-
echo "Removing Homebrew xcodegen (to avoid poisoned bottle)…"
130-
brew uninstall --force xcodegen || true
131-
brew cleanup -s xcodegen || true
132-
fi
133-
134-
echo "Preparing to build XcodeGen from source (this bypasses bottle CT/AMFI issues)."
135-
mkdir -p "$HOME/.local/bin"
136-
TMPDIR=$(mktemp -d)
137-
echo "Cloning XcodeGen into $TMPDIR..."
138-
git clone --depth 1 https://github.com/yonaskolb/XcodeGen.git "$TMPDIR/XcodeGen" || { echo "git clone failed"; exit 20; }
139-
cd "$TMPDIR/XcodeGen"
140-
141-
echo "Swift toolchain:"
142-
swift --version || true
143-
144-
echo "Building xcodegen (swift build -c release)... this may take ~30-90s"
145-
# build for the runner architecture
146-
swift build -c release || { echo "swift build failed"; exit 21; }
147-
148-
BUILT_BIN="$(pwd)/.build/release/xcodegen"
149-
if [ ! -f "$BUILT_BIN" ]; then
150-
echo "ERROR: built binary not found at $BUILT_BIN"
151-
ls -la ./.build || true
152-
exit 22
153-
fi
154-
155-
echo "Installing built xcodegen to \$HOME/.local/bin"
156-
cp "$BUILT_BIN" "$HOME/.local/bin/xcodegen"
157-
chmod +x "$HOME/.local/bin/xcodegen"
158-
export PATH="$HOME/.local/bin:$PATH"
159-
160-
echo "Sanity check: which xcodegen -> $(which xcodegen)"
161-
file "$(which xcodegen)" || true
162-
spctl --assess -vv "$(which xcodegen)" 2>&1 || true
163-
xattr -l "$(which xcodegen)" 2>/dev/null || true
164-
165-
echo "Running xcodegen generate --spec project.yml with local-built binary..."
166-
set +e
16796
xcodegen generate --spec project.yml
168-
final_rc=$?
169-
set -e
170-
171-
if [ $final_rc -eq 0 ]; then
172-
echo "✅ Success: generated project using locally built xcodegen."
173-
sed -n '1,60p' prostore.xcodeproj/project.pbxproj || true
174-
exit 0
175-
else
176-
echo "❌ Failure even after building from source (rc=$final_rc). Dumping diagnostics:"
177-
echo "spctl --assess output for built binary:"
178-
spctl --assess -vv "$HOME/.local/bin/xcodegen" 2>&1 || true
179-
echo "xattr for built binary:"
180-
xattr -l "$HOME/.local/bin/xcodegen" 2>/dev/null || true
181-
echo "ls -la $HOME/.local/bin:"
182-
ls -la "$HOME/.local/bin" || true
183-
echo "Recent log grep (AMFI/CodeSigning/xcodegen):"
184-
log show --style syslog --last 10m 2>/dev/null | egrep -i "AMFI|CodeSigning|xcodegen" || true
185-
exit $final_rc
186-
fi
97+
echo "Generated project at: $(pwd)/prostore.xcodeproj"
98+
echo "project.pbxproj header (first 60 lines):"
99+
sed -n '1,60p' prostore.xcodeproj/project.pbxproj || true
187100
188101
- name: Resolve Swift Packages
189102
run: |

0 commit comments

Comments
 (0)