fix(workflows): streamline macOS app packaging and notarization process
This commit is contained in:
parent
dbb2d66564
commit
4d067474e3
@ -36,44 +36,7 @@ jobs:
|
|||||||
chmod +x ./scripts/mac_build.sh
|
chmod +x ./scripts/mac_build.sh
|
||||||
./scripts/mac_build.sh
|
./scripts/mac_build.sh
|
||||||
|
|
||||||
- name: Package macOS build
|
- name: Sign and Notarize macOS App
|
||||||
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
|
|
||||||
if: ${{ success() }}
|
if: ${{ success() }}
|
||||||
env:
|
env:
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
@ -83,6 +46,9 @@ jobs:
|
|||||||
API_KEY_ID: ${{ secrets.NOTARY_API_KEY_ID }}
|
API_KEY_ID: ${{ secrets.NOTARY_API_KEY_ID }}
|
||||||
API_KEY_ISSUER_ID: ${{ secrets.NOTARY_API_KEY_ISSUER_ID }}
|
API_KEY_ISSUER_ID: ${{ secrets.NOTARY_API_KEY_ISSUER_ID }}
|
||||||
run: |
|
run: |
|
||||||
|
# Create output directory
|
||||||
|
mkdir -p PackagedReleases
|
||||||
|
|
||||||
# Decode the base64 certificate
|
# Decode the base64 certificate
|
||||||
echo "Setting up certificate..."
|
echo "Setting up certificate..."
|
||||||
echo $APPLE_CERTIFICATE_BASE64 | base64 --decode > certificate.p12
|
echo $APPLE_CERTIFICATE_BASE64 | base64 --decode > certificate.p12
|
||||||
@ -130,19 +96,38 @@ jobs:
|
|||||||
# Staple the ticket to the application
|
# Staple the ticket to the application
|
||||||
xcrun stapler staple "$APP_PATH"
|
xcrun stapler staple "$APP_PATH"
|
||||||
|
|
||||||
# Repackage the notarized app
|
# Package the notarized app
|
||||||
rm "PackagedReleases/LuckyRobots-macOS.zip"
|
echo "Creating final package..."
|
||||||
(cd $(dirname "$APP_PATH") && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$(basename "$APP_PATH")")
|
APP_NAME=$(basename "$APP_PATH")
|
||||||
echo "Repackaged notarized app"
|
(cd $(dirname "$APP_PATH") && zip -r "../../PackagedReleases/LuckyRobots-macOS.zip" "$APP_NAME")
|
||||||
|
echo "Created packaged release: PackagedReleases/LuckyRobots-macOS.zip"
|
||||||
else
|
else
|
||||||
echo "Notarization failed: $NOTARIZATION_INFO"
|
echo "Notarization failed: $NOTARIZATION_INFO"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "No app bundle found for signing and notarization"
|
echo "No app bundle found for signing and notarization"
|
||||||
exit 1
|
|
||||||
|
# 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
|
fi
|
||||||
|
|
||||||
|
echo "Packaged releases:"
|
||||||
|
ls -la PackagedReleases/
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f certificate.p12
|
rm -f certificate.p12
|
||||||
security delete-keychain "$KEYCHAIN_PATH"
|
security delete-keychain "$KEYCHAIN_PATH"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user