From cec2ebca9bab8a34248515831bebae243e1783ac Mon Sep 17 00:00:00 2001 From: Ruben Date: Thu, 26 Dec 2024 10:56:40 +0100 Subject: [PATCH] Update macOS build --- .github/workflows/BuildMacOS.yml | 63 ++++++++++--------- Build/Build Avalonia.MacOS.ps1 | 5 +- .../PicView.Avalonia.MacOS.csproj | 5 +- 3 files changed, 41 insertions(+), 32 deletions(-) diff --git a/.github/workflows/BuildMacOS.yml b/.github/workflows/BuildMacOS.yml index 7805c598..9c21bfc7 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 2a41abfc..b8a46199 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 3e0a2d78..b6ecb63e 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