fix(workflows): streamline macOS app packaging and notarization process
Some checks failed
Unreal Engine Build / windows-build (push) Has been cancelled
Unreal Engine Build / linux-build (push) Has been cancelled
Unreal Engine Build / create-release (push) Has been cancelled
Unreal Engine Build / macos-build (push) Has been cancelled

This commit is contained in:
Ozgur 2025-04-13 02:06:08 +02:00
parent dbb2d66564
commit 4d067474e3
No known key found for this signature in database
GPG Key ID: 66CDF27505A35546

View File

@ -36,44 +36,7 @@ jobs:
chmod +x ./scripts/mac_build.sh
./scripts/mac_build.sh
- name: Package macOS build
run: |
echo "Preparing packaged files for release..."
# Find the app bundle in the Builds directory
APP_PATH=$(find Builds -type d -name "*.app" | head -1)
if [ -n "$APP_PATH" ]; then
echo "Found app bundle: $APP_PATH"
# Get the app name
APP_NAME=$(basename "$APP_PATH")
# Create zip file of the app bundle
(cd $(dirname "$APP_PATH") && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$APP_NAME")
echo "Created packaged release: PackagedReleases/LuckyRobots-macOS.zip"
else
echo "No .app bundle found in Builds directory"
# Look for a directory that might be a bundle but not named .app
MAIN_BUILD_DIR=$(find Builds -mindepth 1 -maxdepth 1 -type d | head -1)
if [ -n "$MAIN_BUILD_DIR" ]; then
echo "Found main build directory: $MAIN_BUILD_DIR"
DIR_NAME=$(basename "$MAIN_BUILD_DIR")
# Package this directory as if it were the app
(cd $(dirname "$MAIN_BUILD_DIR") && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$DIR_NAME")
echo "Created packaged release from main directory: PackagedReleases/LuckyRobots-macOS.zip"
else
# Package the entire Builds directory as a fallback
echo "No main directory found, packaging everything"
zip -r "PackagedReleases/LuckyRobots-macOS.zip" Builds
echo "Created fallback package: PackagedReleases/LuckyRobots-macOS.zip"
fi
fi
echo "Packaged releases:"
ls -la PackagedReleases/
echo "tests"
- name: Sign and Notarize macOS App 2
- name: Sign and Notarize macOS App
if: ${{ success() }}
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
@ -83,6 +46,9 @@ jobs:
API_KEY_ID: ${{ secrets.NOTARY_API_KEY_ID }}
API_KEY_ISSUER_ID: ${{ secrets.NOTARY_API_KEY_ISSUER_ID }}
run: |
# Create output directory
mkdir -p PackagedReleases
# Decode the base64 certificate
echo "Setting up certificate..."
echo $APPLE_CERTIFICATE_BASE64 | base64 --decode > certificate.p12
@ -130,18 +96,37 @@ jobs:
# Staple the ticket to the application
xcrun stapler staple "$APP_PATH"
# Repackage the notarized app
rm "PackagedReleases/LuckyRobots-macOS.zip"
(cd $(dirname "$APP_PATH") && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$(basename "$APP_PATH")")
echo "Repackaged notarized app"
# Package the notarized app
echo "Creating final package..."
APP_NAME=$(basename "$APP_PATH")
(cd $(dirname "$APP_PATH") && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$APP_NAME")
echo "Created packaged release: PackagedReleases/LuckyRobots-macOS.zip"
else
echo "Notarization failed: $NOTARIZATION_INFO"
exit 1
fi
else
echo "No app bundle found for signing and notarization"
# Look for a directory that might be a bundle but not named .app
MAIN_BUILD_DIR=$(find Builds -mindepth 1 -maxdepth 1 -type d | head -1)
if [ -n "$MAIN_BUILD_DIR" ]; then
echo "Found main build directory: $MAIN_BUILD_DIR"
# Try to sign this directory instead
/usr/bin/codesign --force --options runtime --sign "Developer ID Application: $APPLE_TEAM_ID" --deep --entitlements "./LuckyRobots.entitlements" "$MAIN_BUILD_DIR"
# Package it
DIR_NAME=$(basename "$MAIN_BUILD_DIR")
(cd $(dirname "$MAIN_BUILD_DIR") && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$DIR_NAME")
echo "Created packaged release: PackagedReleases/LuckyRobots-macOS.zip"
else
echo "No main directory found, cannot sign or package"
exit 1
fi
fi
echo "Packaged releases:"
ls -la PackagedReleases/
# Clean up
rm -f certificate.p12