From b164f93b41ede5e6955be4bd927a90b806b2a49d Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 25 Dec 2024 21:51:33 +0100 Subject: [PATCH] Update macOS build scripts --- .github/workflows/BuildMacOS.yml | 18 +++++++---- Build/Build Avalonia.MacOS arm64.ps1 | 48 ---------------------------- 2 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 Build/Build Avalonia.MacOS arm64.ps1 diff --git a/.github/workflows/BuildMacOS.yml b/.github/workflows/BuildMacOS.yml index b05fc4d37..2dea39d10 100644 --- a/.github/workflows/BuildMacOS.yml +++ b/.github/workflows/BuildMacOS.yml @@ -28,10 +28,12 @@ jobs: id: get-version run: pwsh -File "${{ github.workspace }}/Build/Get-VersionInfo.ps1" - # Step 4 (x64): Publish arm64 version + # Step 4: Build arm64 version - name: Build arm64 version run: | - pwsh -File "${{ github.workspace }}\Build\Build Avalonia.MacOS.ps1" -Platform "arm64" -outputPath "${{ github.workspace }}\Build\PicView-v${{steps.get-version.outputs.version}}-osx-arm64" + pwsh -File "${{ github.workspace }}/Build/Build\ Avalonia.MacOS\ arm64.ps1" ` + -Platform "arm64" ` + -outputPath "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64" shell: pwsh # Step 5: Upload arm64 artifact @@ -39,13 +41,15 @@ jobs: uses: actions/upload-artifact@v4 with: name: PicView-v${{steps.get-version.outputs.version}}-macOS-arm64 - path: ${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-macOS-arm64/ + path: ${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-arm64/ retention-days: 14 - # Step 6: Build x64 version by modifying the platform parameter + # Step 6: Build x64 version - name: Build x64 version run: | - pwsh -File "${{ github.workspace }}\Build\Build Avalonia.MacOS.ps1" -Platform "x64" -outputPath "${{ github.workspace }}\Build\PicView-v${{steps.get-version.outputs.version}}-osx-x64" + pwsh -File "${{ github.workspace }}/Build/Build\ Avalonia.MacOS\ arm64.ps1" ` + -Platform "x64" ` + -outputPath "${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-x64" shell: pwsh # Step 7: Upload x64 artifact @@ -53,5 +57,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: PicView-v${{steps.get-version.outputs.version}}-macOS-x64 - path: ${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-macOS-x64/ - retention-days: 14 + path: ${{ github.workspace }}/Build/PicView-v${{steps.get-version.outputs.version}}-osx-x64/ + retention-days: 14 \ No newline at end of file diff --git a/Build/Build Avalonia.MacOS arm64.ps1 b/Build/Build Avalonia.MacOS arm64.ps1 deleted file mode 100644 index 6beb174a2..000000000 --- a/Build/Build Avalonia.MacOS arm64.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -param ( - [Parameter()] - [string]$Platform, - - [Parameter()] - [string]$outputPath -) - -# Define the core project path relative to the script's location -$coreProjectPath = Join-Path -Path $PSScriptRoot -ChildPath "..\src\PicView.Core\PicView.Core.csproj" - -# Load the .csproj file as XML -[xml]$coreCsproj = Get-Content $coreProjectPath - -# Define the package reference to replace -$packageRefX64 = "Magick.NET-Q8-x64" -$packageRefArm64 = "Magick.NET-Q8-arm64" - -# Find the Magick.NET package reference and update it based on the platform -$packageNodes = $coreCsproj.Project.ItemGroup.PackageReference | Where-Object { $_.Include -eq $packageRefX64 -or $_.Include -eq $packageRefArm64 } -if ($packageNodes) { - foreach ($packageNode in $packageNodes) { - if ($Platform -eq "arm64") { - $packageNode.Include = $packageRefArm64 - } else { - $packageNode.Include = $packageRefX64 - } - } -} - -# Save the updated .csproj file -$coreCsproj.Save($coreProjectPath) - -# Define the project path for the actual build target -$avaloniaProjectPath = Join-Path -Path $PSScriptRoot -ChildPath "..\src\PicView.Avalonia.MacOS\PicView.Avalonia.MacOS.csproj" - -# Run dotnet publish for the Avalonia project -dotnet publish $avaloniaProjectPath --runtime "win-$Platform" --self-contained true --configuration Release --output $outputPath - - -# Remove the PDB file -$pdbPath = Join-Path -Path $outputPath -ChildPath "PicView.Avalonia.pdb" -if (Test-Path $pdbPath) { - Remove-Item -Path $pdbPath -Force -} - -#Remove uninstended space -Rename-Item -path $outputPath -NewName $outputPath.Replace(" ","") \ No newline at end of file