From b1452dabc314d58c205b77877c8a2154ecd64e48 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 24 Aug 2026 20:54:31 +0000 Subject: [PATCH] ci: fail the Windows build when a publish fails The four dotnet publish calls share one run: block, and on windows-latest that block is pwsh. PowerShell does not stop at a native command that fails, and the step is judged by $LASTEXITCODE after the whole block, so only the last publish was ever able to fail the build. That is not hypothetical. LibationWinForms stopped compiling and every run since stayed green: the WinForms publish errored, the three after it succeeded, the step exited 0, and the job uploaded a Libation-Classic zip containing Hangover and the CLI but no Libation.exe at all. upload-artifact's if-no-files-found did not help, since the zip itself was there. Check the exit code after each publish, and refuse to package output with no Libation.exe in it - both UIs build under that name. Linux and macOS are not affected; their steps are bash, which Actions runs with -e. Co-authored-by: rmcrackan --- .github/workflows/build-windows.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 9b36df17..e7c2d264 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -66,10 +66,20 @@ jobs: "-p:PublishReadyToRun=${{ inputs.publish-r2r }}", "-p:SelfContained=true") - dotnet publish "Libation${{ matrix.ui }}/Libation${{ matrix.ui }}.csproj" $PUBLISH_ARGS - dotnet publish "LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj" $PUBLISH_ARGS - dotnet publish "LibationCli/LibationCli.csproj" $PUBLISH_ARGS - dotnet publish "Hangover${{ matrix.ui }}/Hangover${{ matrix.ui }}.csproj" $PUBLISH_ARGS + # PowerShell does not stop at a native command that fails, and the step is judged by the exit code + # of the last one, so a publish that fails anywhere but the end passes as a green build. That is not + # hypothetical: LibationWinForms failed to compile for a while and every run stayed green, uploading + # a Libation-Classic zip with no Libation.exe in it. Check each one. + $projects = @( + "Libation${{ matrix.ui }}/Libation${{ matrix.ui }}.csproj", + "LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj", + "LibationCli/LibationCli.csproj", + "Hangover${{ matrix.ui }}/Hangover${{ matrix.ui }}.csproj") + + foreach ($project in $projects) { + dotnet publish "$project" $PUBLISH_ARGS + if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed for $project" } + } - name: Zip artifact id: zip @@ -81,6 +91,11 @@ jobs: "WindowsConfigApp.deps.json") foreach ($file in $delfiles){ if (test-path $file){ Remove-Item $file } } + + # Both UIs publish as Libation.exe. upload-artifact's if-no-files-found only proves the zip exists, + # which it does whether or not the app is inside it, so say outright that it has to be. + if (-not (Test-Path "Libation.exe")) { throw "Libation.exe is missing from the publish output" } + $artifact="${{ matrix.artifact_stem }}.${{ inputs.libation-version }}-windows-${{ matrix.release_name }}-${{ matrix.architecture }}.zip" "artifact=$artifact" >> $env:GITHUB_OUTPUT Compress-Archive -Path * -DestinationPath "$artifact"