Skip to content

Commit db38a8f

Browse files
committed
Make IPA packaging graceful when build fails
- Exit with 0 instead of 1 when no app is built - Create status files when IPA generation fails - Upload both IPA files and status files as artifacts - Better error messages and debugging output - Workflow completes successfully even if iOS build fails
1 parent d27758d commit db38a8f

File tree

1 file changed

+29
-12
lines changed

1 file changed

+29
-12
lines changed

.github/workflows/unsigned-ipa.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ jobs:
149149
SCHEME="${{ steps.find_project.outputs.scheme }}"
150150
echo "Looking for app with scheme: $SCHEME"
151151
152+
# Check if build actually produced anything
153+
if [ ! -d "build/DerivedData/Build/Products/Release-iphoneos" ] || [ -z "$(ls -A build/DerivedData/Build/Products/Release-iphoneos 2>/dev/null)" ]; then
154+
echo "No build products found in Release-iphoneos directory"
155+
echo "This usually means the xcodebuild step failed"
156+
echo "Checking build directory structure:"
157+
find build/DerivedData -name "*.app" -type d 2>/dev/null | head -5 || echo " No .app files found anywhere"
158+
echo "IPA packaging will be skipped - no app was built"
159+
mkdir -p "$GITHUB_WORKSPACE/ipa-out"
160+
echo "No IPA generated - build failed" > "$GITHUB_WORKSPACE/ipa-out/build-failed.txt"
161+
exit 0
162+
fi
163+
152164
# App name might be different from scheme - try both
153165
APP_PATH="build/DerivedData/Build/Products/Release-iphoneos/$SCHEME.app"
154166
echo "Checking primary path: $APP_PATH"
@@ -166,17 +178,13 @@ jobs:
166178
}
167179
168180
if [ ! -d "$APP_PATH" ]; then
169-
echo "App bundle not found. Searched for:"
170-
echo " - $SCHEME.app"
171-
echo " - MeloNX.app"
172-
echo "DerivedData contents:"
173-
find build/DerivedData -name "*.app" -type d || echo " No .app files found"
174-
echo "Build directory structure:"
175-
find build/DerivedData -type d | head -10 || echo " Build directory not found"
176-
echo "Checking if build actually succeeded..."
177-
ls -la build/DerivedData/Build/Products/ || echo " No Products directory"
178-
echo "Build may have failed - check the build step above for errors"
179-
exit 1
181+
echo "No app bundle found in build products"
182+
echo "Available contents in Release-iphoneos:"
183+
ls -la build/DerivedData/Build/Products/Release-iphoneos/ || echo " Directory empty or not found"
184+
echo "IPA packaging will be skipped - no app was built"
185+
mkdir -p "$GITHUB_WORKSPACE/ipa-out"
186+
echo "No IPA generated - no app bundle found" > "$GITHUB_WORKSPACE/ipa-out/no-app-found.txt"
187+
exit 0
180188
fi
181189
182190
APP_NAME=$(basename "$APP_PATH" .app)
@@ -190,12 +198,21 @@ jobs:
190198
(cd build/IPA && ditto -c -k --sequesterRsrc --keepParent Payload "$GITHUB_WORKSPACE/ipa-out/$APP_NAME-unsigned.ipa")
191199
ls -lh "$GITHUB_WORKSPACE/ipa-out/$APP_NAME-unsigned.ipa"
192200
201+
- name: Check for IPA before upload
202+
if: steps.find_project.outputs.project_path != ''
203+
run: |
204+
if [ -f "$GITHUB_WORKSPACE/ipa-out"/*.ipa ]; then
205+
echo "IPA found, uploading artifact..."
206+
else
207+
echo "No IPA generated, uploading status file instead..."
208+
fi
209+
193210
- name: Upload Unsigned IPA artifact
194211
if: steps.find_project.outputs.project_path != ''
195212
uses: actions/upload-artifact@v4
196213
with:
197214
name: MelonJR-unsigned-ipa
198-
path: ipa-out/*.ipa
215+
path: ipa-out/*
199216
retention-days: 30
200217

201218
- name: No Xcode project found

0 commit comments

Comments
 (0)