fix(actions): improve macOS build workflow with enhanced error handling and diagnostics for notarization
Some checks failed
Test macOS Build Action / test-macos-build (push) Failing after 15m5s

This commit is contained in:
Ozgur 2025-04-15 12:21:26 +02:00
parent ac8f5892df
commit bed34a6009
No known key found for this signature in database
GPG Key ID: 66CDF27505A35546

View File

@ -279,40 +279,74 @@ jobs:
# Fix common issues that may cause notarization failure
- name: Fix common issues for notarization
continue-on-error: true # Don't fail the workflow if this step fails
run: |
echo "🛠️ Fixing common issues that may cause notarization failure..."
# Make sure APP_PATH is set and app exists
APP_PATH="${{ env.APP_PATH }}"
if [ -z "$APP_PATH" ]; then
echo "⚠️ APP_PATH environment variable is not set. Skipping fixes."
exit 0
fi
# Remove get-task-allow entitlement from Info.plist files
if [ ! -d "$APP_PATH" ]; then
echo "⚠️ App bundle does not exist at $APP_PATH. Skipping fixes."
exit 0
fi
echo "🔍 App bundle details:"
ls -la "$APP_PATH"
ls -la "$APP_PATH/Contents" 2>/dev/null || echo "No Contents directory found"
# Remove get-task-allow entitlement from Info.plist files with error handling
echo "Checking for get-task-allow entitlement..."
find "$APP_PATH" -name "*.plist" -exec plutil -convert xml1 {} \; -exec grep -l "get-task-allow" {} \; | while read -r plist_file; do
echo "Removing get-task-allow from $plist_file"
/usr/libexec/PlistBuddy -c "Delete :com.apple.security.get-task-allow" "$plist_file" 2>/dev/null || true
find "$APP_PATH" -name "*.plist" 2>/dev/null | while read -r plist_file; do
echo "Checking plist file: $plist_file"
plutil -convert xml1 "$plist_file" 2>/dev/null || echo "⚠️ Could not convert $plist_file to XML format"
if grep -q "get-task-allow" "$plist_file" 2>/dev/null; then
echo "Removing get-task-allow from $plist_file"
/usr/libexec/PlistBuddy -c "Delete :com.apple.security.get-task-allow" "$plist_file" 2>/dev/null || echo "⚠️ Failed to remove get-task-allow from $plist_file"
fi
done
# Check for problematic libraries that cause issues
# Check for problematic libraries with error handling
echo "Looking for problematic files..."
PROBLEM_FILES=$(find "$APP_PATH" -type f -name "*.dylib" | grep -i "boost\|tbb\|ogg\|vorbis\|onnx")
if [ -n "$PROBLEM_FILES" ]; then
echo "Found potentially problematic libraries. These will be carefully handled during signing:"
echo "$PROBLEM_FILES" | head -10
if [ $(echo "$PROBLEM_FILES" | wc -l) -gt 10 ]; then
echo "... and $(echo "$PROBLEM_FILES" | wc -l) more"
if [ -d "$APP_PATH" ]; then
PROBLEM_FILES=$(find "$APP_PATH" -type f -name "*.dylib" 2>/dev/null | grep -i "boost\|tbb\|ogg\|vorbis\|onnx" 2>/dev/null || echo "")
if [ -n "$PROBLEM_FILES" ]; then
echo "Found potentially problematic libraries. These will be carefully handled during signing:"
echo "$PROBLEM_FILES" | head -10
COUNT=$(echo "$PROBLEM_FILES" | wc -l)
if [ "$COUNT" -gt 10 ]; then
echo "... and $((COUNT - 10)) more"
fi
else
echo "No problematic libraries found."
fi
else
echo "⚠️ Cannot search for problematic files because app bundle does not exist."
fi
# Verify CrashReportClient specifically
CRASH_REPORTER=$(find "$APP_PATH" -path "*CrashReportClient.app*" -type d | head -1)
echo "Checking for CrashReportClient..."
CRASH_REPORTER=$(find "$APP_PATH" -path "*CrashReportClient.app*" -type d 2>/dev/null | head -1 || echo "")
if [ -n "$CRASH_REPORTER" ]; then
echo "Found CrashReportClient at $CRASH_REPORTER"
if [ -f "$CRASH_REPORTER/Contents/Info.plist" ]; then
# Ensure it has the correct bundle ID format
CRASH_BUNDLE_ID="$BUNDLE_ID.CrashReportClient"
CRASH_BUNDLE_ID="${{ env.BUNDLE_ID }}.CrashReportClient"
echo "Setting CrashReportClient bundle ID to $CRASH_BUNDLE_ID"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $CRASH_BUNDLE_ID" "$CRASH_REPORTER/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $CRASH_BUNDLE_ID" "$CRASH_REPORTER/Contents/Info.plist" 2>/dev/null || echo "⚠️ Failed to set bundle ID for CrashReportClient"
else
echo "⚠️ Info.plist not found for CrashReportClient"
fi
else
echo "No CrashReportClient found in app bundle."
fi
echo "✅ Completed fixups for notarization"
shell: bash
# Use the macos-notarize action to sign and notarize the app