diff --git a/.github/workflows/BuildMacOS.yml b/.github/workflows/BuildMacOS.yml index 7805c5983..9c21bfc7d 100644 --- a/.github/workflows/BuildMacOS.yml +++ b/.github/workflows/BuildMacOS.yml @@ -39,34 +39,41 @@ jobs: - name: Prepare and Sign arm64 App Bundle run: | - # Create entitlements file - cat > entitlements.plist << EOF - - - - - com.apple.security.cs.allow-jit - - com.apple.security.cs.allow-unsigned-executable-memory - - com.apple.security.cs.disable-library-validation - - - - EOF - - # Sign all dylibs and binaries - find "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" -type f -name "*.dylib" -o -name "PicView.Avalonia.MacOS" | while read file; do - codesign --force --options runtime --sign - --entitlements entitlements.plist "$file" - done - - # Sign the app bundle - codesign --force --options runtime --sign - --entitlements entitlements.plist "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" - - # Step 5: Create DMG for arm64 - - name: Create DMG for arm64 - run: | - hdiutil create -volname "PicView" -srcfolder "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" -ov -format UDZO "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64.dmg" + # Create entitlements file + cat > entitlements.plist << EOF + + + + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + + + EOF + + APP_PATH="${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" + + # Verify bundle structure + if [ ! -f "$APP_PATH/Contents/Info.plist" ]; then + echo "Error: Info.plist not found in the expected location" + exit 1 + fi + + # Sign all dylibs and binaries + find "$APP_PATH/Contents/MacOS" -type f \( -name "*.dylib" -o -name "PicView.Avalonia.MacOS" \) | while read file; do + codesign --force --options runtime --sign - --entitlements entitlements.plist "$file" + done + + # Sign the app bundle + codesign --force --options runtime --sign - --entitlements entitlements.plist "$APP_PATH" + # Step 5: Create DMG for arm64 + - name: Create DMG for arm64 + run: | + hdiutil create -volname "PicView" -srcfolder "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/PicView.app" -ov -format UDZO "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64.dmg" # Step 6: Upload arm64 artifacts diff --git a/Build/Build Avalonia.MacOS.ps1 b/Build/Build Avalonia.MacOS.ps1 index 2a41abfcf..b8a461991 100644 --- a/Build/Build Avalonia.MacOS.ps1 +++ b/Build/Build Avalonia.MacOS.ps1 @@ -60,6 +60,7 @@ New-Item -ItemType Directory -Force -Path $macOSPath New-Item -ItemType Directory -Force -Path $resourcesPath # Create Info.plist +$infoPlistPath = Join-Path -Path $contentsPath -ChildPath "Info.plist" # Add this line to specify the correct path $infoPlistContent = @" @@ -78,7 +79,7 @@ $infoPlistContent = @" CFBundleSignature ???? CFBundleExecutable - PicView.Avalonia.MacOS + PicView CFBundleIconFile AppIcon.icns CFBundleShortVersionString @@ -97,6 +98,8 @@ $infoPlistContent = @" NSRequiresAquaSystemAppearance + LSApplicationCategoryType + public.app-category.graphics-design "@ diff --git a/src/PicView.Avalonia.MacOS/PicView.Avalonia.MacOS.csproj b/src/PicView.Avalonia.MacOS/PicView.Avalonia.MacOS.csproj index 3e0a2d782..b6ecb63e9 100644 --- a/src/PicView.Avalonia.MacOS/PicView.Avalonia.MacOS.csproj +++ b/src/PicView.Avalonia.MacOS/PicView.Avalonia.MacOS.csproj @@ -1,9 +1,7 @@  WinExe - - net9.0 + net9.0 x64;arm64 enable true @@ -20,6 +18,7 @@ © Ruben Hyldgaard Negendahl enable PicView + PicView none