From 9fc38c505cd55f470280e1b1c33a67cad18b4a44 Mon Sep 17 00:00:00 2001 From: Tom Moroney Date: Mon, 9 Dec 2024 11:06:00 +0000 Subject: [PATCH] Updated mac workflow script --- .github/workflows/package-mac.yml | 53 ++++++++++++++++++------------- .gitignore | 1 + 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/.github/workflows/package-mac.yml b/.github/workflows/package-mac.yml index ea52ed5..c5baeea 100644 --- a/.github/workflows/package-mac.yml +++ b/.github/workflows/package-mac.yml @@ -66,6 +66,25 @@ jobs: --key "Notarization_AuthKey.p8" \ --key-id "$APPLE_NOTARIZE_ID" \ --issuer "$APPLE_ISSUER" + + - name: Install Dependencies + run: | + cd AutoSubs-App + npm install + + - name: Bundle Tauri App + run: | + cd AutoSubs-App + export APPLE_SIGNING_IDENTITY="Developer ID Application: ${{ secrets.APPLE_IDENTITY }}" + npm run tauri build + + - name: Create Mac Package + run: | + # Create the package directory + mkdir Mac-Package/Payload + + # Move the app to the package + mv AutoSubs-App/src-tauri/target/release/bundle/macos/AutoSubs.app Mac-Package/Payload - name: Package Python Server run: | @@ -78,48 +97,38 @@ jobs: - name: Move Python Server to resources folder run: | - mv "Transcription-Server/dist/Transcription-Server" "AutoSubs-App/src-tauri/resources" + mv "Transcription-Server/dist/Transcription-Server" "Mac-Package/Payload/AutoSubs.app/Contents/Resources/resources" - name: Code Sign Python Server run: | # Define variables IDENTITY="Developer ID Application: ${{ secrets.APPLE_IDENTITY }}" - ENTITLEMENTS="$(pwd)/Signing/entitlements.plist" - APP_DIR="$(pwd)/AutoSubs-App/src-tauri/resources/Transcription-Server" + ENTITLEMENTS="$(pwd)/Signing/entitlements.plist" # Use absolute path to avoid issues + APP_DIR="$(pwd)/Mac-Package/Payload/AutoSubs.app/Contents/Resources/resources/Transcription-Server" # Use absolute path + AUTOSUBS_BINARY="$(pwd)/Mac-Package/Payload/AutoSubs.app/Contents/MacOS/autosubs" # Use absolute path + # Function to sign a single file sign_file() { local file="$1" echo "Signing $file..." codesign --force --options runtime --timestamp --entitlements "$ENTITLEMENTS" --sign "$IDENTITY" "$file" } + export -f sign_file # Export the function so it's available in subshells export IDENTITY # Export IDENTITY so it's available in subshells export ENTITLEMENTS # Export ENTITLEMENTS so it's available in subshells + # Sign the main executable sign_file "$APP_DIR/transcription-server" + # Sign all embedded binaries and executables in the _internal directory - find "$APP_DIR/_internal" -type f \( -name "*.dylib" -o -name "*.so" -o -name "*.exe" -o -name "*.bin" -o -name "ffmpeg*" \) -exec bash -c 'sign_file "$0"' {} \; + find "$APP_DIR/_internal" -type f \( -name "*.dylib" -o -name "*.so" -o -name "*.exe" -o -name "*.bin" -o -name "ffmpeg*" -o -name "Python" \) -exec bash -c 'sign_file "$0"' {} \; + # Sign any other executables in the main app directory find "$APP_DIR" -type f -perm +111 -exec bash -c 'sign_file "$0"' {} \; - - - name: Install Dependencies - run: | - cd AutoSubs-App - npm install - - - name: Bundle Tauri App - run: | - cd AutoSubs-App - export APPLE_SIGNING_IDENTITY="Developer ID Application: ${{ secrets.APPLE_IDENTITY }}" - npm run tauri build - - - name: Create Mac Package - run: | - # Create the package directory - mkdir Mac-Package/Payload - # Copy the app to the package - cp -r AutoSubs-App/src-tauri/target/release/bundle/macos/AutoSubs.app Mac-Package/Payload + # Sign the main app binary + codesign --force --options runtime --timestamp --entitlements "$ENTITLEMENTS" --sign "$IDENTITY" "$AUTOSUBS_BINARY" - name: Create PKG Installer run: | diff --git a/.gitignore b/.gitignore index 9887bfd..effd130 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ sign.sh /Transcription-Server/dist /Transcription-Server/build AutoSubs-App/package-lock.json +/Mac-Package/Payload