diff --git a/.gitea/workflows/macos-build.yml b/.gitea/workflows/macos-build.yml index 576506cc..e57b3498 100644 --- a/.gitea/workflows/macos-build.yml +++ b/.gitea/workflows/macos-build.yml @@ -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,19 +96,38 @@ 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" - 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 + echo "Packaged releases:" + ls -la PackagedReleases/ + # Clean up rm -f certificate.p12 security delete-keychain "$KEYCHAIN_PATH"