fix(actions): improve bundle ID verification process in macOS build workflow
Some checks failed
Test macOS Build Action / test-macos-build (push) Failing after 14m20s

This commit is contained in:
Ozgur 2025-04-15 14:07:53 +02:00
parent 6b128e8cb4
commit 63ca0d4883
No known key found for this signature in database
GPG Key ID: 66CDF27505A35546
2 changed files with 43 additions and 13 deletions

View File

@ -141,6 +141,11 @@ jobs:
# Export APP_PATH for next steps to use # Export APP_PATH for next steps to use
echo "APP_PATH=$MAIN_APP_PATH" >> "$GITHUB_ENV" echo "APP_PATH=$MAIN_APP_PATH" >> "$GITHUB_ENV"
# Note: While bundle ID should be set by Unreal Engine build system based on DefaultGame.ini
# and LuckyWorld.Build.cs settings, we still check and fix if needed as a safety measure,
# since UE builds can sometimes have issues with bundle ID propagation
echo "Checking bundle IDs (fallback fix in case UE didn't properly apply settings)..."
# Fix bundle ID in Info.plist before signing # Fix bundle ID in Info.plist before signing
if [ -f "$MAIN_APP_PATH/Contents/Info.plist" ]; then if [ -f "$MAIN_APP_PATH/Contents/Info.plist" ]; then
echo "Checking current bundle identifier..." echo "Checking current bundle identifier..."
@ -153,7 +158,7 @@ jobs:
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $BUNDLE_ID" "$MAIN_APP_PATH/Contents/Info.plist" /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $BUNDLE_ID" "$MAIN_APP_PATH/Contents/Info.plist"
echo "Updated bundle ID in Info.plist: $(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$MAIN_APP_PATH/Contents/Info.plist")" echo "Updated bundle ID in Info.plist: $(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$MAIN_APP_PATH/Contents/Info.plist")"
else else
echo "Bundle ID is already correct: $BUNDLE_ID" echo "Bundle ID is already correct: $BUNDLE_ID"
fi fi
else else
echo "WARNING: Could not find Info.plist in app bundle." echo "WARNING: Could not find Info.plist in app bundle."
@ -162,17 +167,23 @@ jobs:
# Find and repair nested app bundles as well (like CrashReportClient.app) # Find and repair nested app bundles as well (like CrashReportClient.app)
NESTED_APPS=$(find "$MAIN_APP_PATH" -name "*.app" -type d) NESTED_APPS=$(find "$MAIN_APP_PATH" -name "*.app" -type d)
if [ -n "$NESTED_APPS" ]; then if [ -n "$NESTED_APPS" ]; then
echo "Found nested app bundles, fixing their bundle IDs:" echo "Found nested app bundles, checking their bundle IDs:"
echo "$NESTED_APPS" | while read -r NESTED_APP; do echo "$NESTED_APPS" | while read -r NESTED_APP; do
if [ -f "$NESTED_APP/Contents/Info.plist" ]; then if [ -f "$NESTED_APP/Contents/Info.plist" ]; then
NESTED_NAME=$(basename "$NESTED_APP" .app) NESTED_NAME=$(basename "$NESTED_APP" .app)
NESTED_BUNDLE_ID="$BUNDLE_ID.$NESTED_NAME" NESTED_BUNDLE_ID="$BUNDLE_ID.$NESTED_NAME"
CURRENT_NESTED_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$NESTED_APP/Contents/Info.plist")
if [ "$CURRENT_NESTED_ID" != "$NESTED_BUNDLE_ID" ]; then
echo "Setting nested bundle ID to $NESTED_BUNDLE_ID for $NESTED_APP" echo "Setting nested bundle ID to $NESTED_BUNDLE_ID for $NESTED_APP"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $NESTED_BUNDLE_ID" "$NESTED_APP/Contents/Info.plist" /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $NESTED_BUNDLE_ID" "$NESTED_APP/Contents/Info.plist"
# Verify the change # Verify the change
UPDATED_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$NESTED_APP/Contents/Info.plist") UPDATED_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$NESTED_APP/Contents/Info.plist")
echo "Updated nested app bundle ID: $UPDATED_ID" echo "Updated nested app bundle ID: $UPDATED_ID"
else
echo "✅ Nested app $NESTED_NAME already has correct bundle ID: $CURRENT_NESTED_ID"
fi
fi fi
done done
fi fi
@ -210,8 +221,15 @@ jobs:
if [ -f "$CRASH_REPORTER/Contents/Info.plist" ]; then if [ -f "$CRASH_REPORTER/Contents/Info.plist" ]; then
# Ensure it has the correct bundle ID format # Ensure it has the correct bundle ID format
CRASH_BUNDLE_ID="$BUNDLE_ID.CrashReportClient" CRASH_BUNDLE_ID="$BUNDLE_ID.CrashReportClient"
CURRENT_CRASH_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$CRASH_REPORTER/Contents/Info.plist")
if [ "$CURRENT_CRASH_ID" != "$CRASH_BUNDLE_ID" ]; then
echo "Setting CrashReportClient bundle ID to $CRASH_BUNDLE_ID" 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"
echo "Updated CrashReportClient bundle ID: $(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$CRASH_REPORTER/Contents/Info.plist")"
else
echo "✅ CrashReportClient already has correct bundle ID: $CURRENT_CRASH_ID"
fi
fi fi
fi fi
shell: bash shell: bash

View File

@ -112,13 +112,25 @@ fi
# Post-build process - set bundle ID # Post-build process - set bundle ID
echo "" echo ""
echo "🔧 Performing post-build fix for bundle ID..." echo "🔍 Checking bundle ID in built app..."
echo "Note: Bundle ID should be automatically set by Unreal Engine based on DefaultGame.ini and"
echo "LuckyWorld.Build.cs settings, but UE sometimes fails to apply it correctly."
echo "Therefore, we keep this check and fix as a safety measure."
if [ -n "$APP_PATH" ]; then if [ -n "$APP_PATH" ]; then
INFO_PLIST="$APP_PATH/Contents/Info.plist" INFO_PLIST="$APP_PATH/Contents/Info.plist"
if [ -f "$INFO_PLIST" ]; then if [ -f "$INFO_PLIST" ]; then
CURRENT_BUNDLE_ID=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$INFO_PLIST")
echo "Current bundle ID: $CURRENT_BUNDLE_ID"
if [ "$CURRENT_BUNDLE_ID" != "com.luckyrobots.luckyworld" ]; then
echo "Bundle ID mismatch - fixing it!"
echo "Setting bundle identifier to com.luckyrobots.luckyworld" echo "Setting bundle identifier to com.luckyrobots.luckyworld"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.luckyrobots.luckyworld" "$INFO_PLIST" /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier com.luckyrobots.luckyworld" "$INFO_PLIST"
echo "Updated bundle ID: $(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$INFO_PLIST")" echo "Updated bundle ID: $(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" "$INFO_PLIST")"
else
echo "✅ Bundle ID is already correct: com.luckyrobots.luckyworld"
fi
else else
echo "⚠️ Info.plist not found at $INFO_PLIST" echo "⚠️ Info.plist not found at $INFO_PLIST"
fi fi