diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09fbfec..9350af5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,6 +60,20 @@ jobs: if: ${{ github.event_name != 'pull_request' }} run: '"%programfiles(x86)%/Inno Setup 6/iscc.exe" "setup/MSURandomizer.iss"' shell: cmd + - name: Sync version from Library to App and rebuild + if: ${{ github.event_name != 'pull_request' }} + run: | + $libContent = Get-Content -Path "MSURandomizerLibrary/MSURandomizerLibrary.csproj" -Raw + if ($libContent -match '(?.*?)') { + $version = $Matches['version'] + Write-Host "Syncing version $version to MSURandomizer/MSURandomizer.csproj" + (Get-Content -Path "MSURandomizer/MSURandomizer.csproj") -replace '.*?', "$version" | Set-Content -Path "MSURandomizer/MSURandomizer.csproj" + dotnet build MSURandomizer/MSURandomizer.csproj -c Release --no-restore -p:PostBuildEvent= + } else { + Write-Error "Could not find version in MSURandomizerLibrary/MSURandomizerLibrary.csproj" + exit 1 + } + shell: pwsh - name: Copy Nuget Packages if: ${{ github.event_name != 'pull_request' }} working-directory: setup @@ -92,14 +106,23 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x + - name: Restore dependencies + if: ${{ github.event_name == 'pull_request' }} + run: dotnet restore + - name: Build + if: ${{ github.event_name == 'pull_request' }} + run: dotnet build --no-restore -p:PostBuildEvent= - name: Install PupNet + if: ${{ github.event_name != 'pull_request' }} run: dotnet tool install -g KuiperZone.PupNet - name: Download AppImageTool + if: ${{ github.event_name != 'pull_request' }} run: | wget -P "$HOME/.local/bin" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" chmod +x "$HOME/.local/bin/appimagetool-x86_64.AppImage" appimagetool-x86_64.AppImage --version - name: Run PupNet + if: ${{ github.event_name != 'pull_request' }} run: | version_number="${{ needs.build-windows.outputs.version-number }}" base_version="${version_number%%-*}" @@ -163,19 +186,24 @@ jobs: needs: [build-windows, build-linux] + if: ${{ github.event_name != 'pull_request' }} + permissions: contents: write steps: - uses: actions/download-artifact@v5 + if: ${{ github.event_name != 'pull_request' }} with: name: MSURandomizerWindows path: out - uses: actions/download-artifact@v5 + if: ${{ github.event_name != 'pull_request' }} with: name: MSURandomizerLinux path: out - uses: actions/download-artifact@v5 + if: ${{ github.event_name != 'pull_request' }} with: name: MSURandomizerMac path: out @@ -186,6 +214,7 @@ jobs: path: "out/*" name: MSURandomizer_${{ needs.build-windows.outputs.version-number }} - name: Delete old artifacts + if: ${{ github.event_name != 'pull_request' }} uses: geekyeggo/delete-artifact@v5 with: name: | diff --git a/MSURandomizer/MSURandomizer.csproj b/MSURandomizer/MSURandomizer.csproj index 3376179..7cd3c7e 100644 --- a/MSURandomizer/MSURandomizer.csproj +++ b/MSURandomizer/MSURandomizer.csproj @@ -5,7 +5,7 @@ true app.manifest true - 3.2.4-beta.3 + 3.2.1 MSURandomizerIcon.ico true MattEqualsCoder.MSURandomizer.Avalonia diff --git a/MSURandomizerLibrary/MSURandomizerLibrary.csproj b/MSURandomizerLibrary/MSURandomizerLibrary.csproj index 66f0287..07ab602 100644 --- a/MSURandomizerLibrary/MSURandomizerLibrary.csproj +++ b/MSURandomizerLibrary/MSURandomizerLibrary.csproj @@ -14,7 +14,7 @@ False False snupkg - 3.2.4-beta.2 + 3.2.4 MattEqualsCoder.MSURandomizer.Library True net8.0;net9.0;net10.0 diff --git a/MSURandomizerLibrary/Services/MsuSelectorService.cs b/MSURandomizerLibrary/Services/MsuSelectorService.cs index 983bd49..446c3e5 100644 --- a/MSURandomizerLibrary/Services/MsuSelectorService.cs +++ b/MSURandomizerLibrary/Services/MsuSelectorService.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Runtime.InteropServices; using Microsoft.Extensions.Logging; using MSURandomizerLibrary.Configs; using MSURandomizerLibrary.Messenger; @@ -445,6 +446,8 @@ private MsuSelectorResponse SaveMsuInternal(Msu msu, string outputPath, Msu? pre _ = _msuMessageSender.SendMsuGenerated(outputMsu); } + _logger.LogInformation("MSU save {Status}: {Message}", response.Successful ? "successful" : "unsuccessful", response.Message); + return response; } @@ -538,7 +541,12 @@ private bool CreatePcmFile(string source, string destination) { if (OperatingSystem.IsWindows()) { - NativeMethods.CreateHardLink(destination, source, IntPtr.Zero); + if (!NativeMethods.CreateHardLink(destination, source, IntPtr.Zero)) + { + var error = Marshal.GetLastWin32Error(); + _logger.LogError("Failed to create hard link for {Destination} to {Source}: Error {Code}", destination, source, error); + return false; + } } else { diff --git a/MSURandomizerLibraryTests/MSURandomizerLibraryTests.csproj b/MSURandomizerLibraryTests/MSURandomizerLibraryTests.csproj index 4f08547..5e022c0 100644 --- a/MSURandomizerLibraryTests/MSURandomizerLibraryTests.csproj +++ b/MSURandomizerLibraryTests/MSURandomizerLibraryTests.csproj @@ -6,7 +6,7 @@ false - net8.0;net9.0;net10.0 + net10.0