From eab8873c14db8a627227a6128bbaedacd00fc4c2 Mon Sep 17 00:00:00 2001 From: ergosteur <1992147+ergosteur@users.noreply.github.com> Date: Mon, 16 Mar 2026 13:01:47 -0400 Subject: [PATCH] Refactor GitHub Actions build workflow Reorganize build steps for .NET project and add cleaning step. --- .github/workflows/build.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a94ad7..b76622a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - # This replaces the invalid 'autocrlf' input - name: Configure Git Line Endings run: git config --global core.autocrlf input @@ -28,18 +27,28 @@ jobs: - name: Restore dependencies run: dotnet restore - - name: Build Standalone (Includes Runtime) - run: > - dotnet publish SshHandler/SshHandler.csproj --configuration Release --runtime win-x64 - --self-contained true /p:PublishSingleFile=true - -o ./publish-standalone - + # 1. Build Framework-Dependent FIRST (The tiny one) - name: Build Framework-Dependent (Requires .NET 8) run: > dotnet publish SshHandler/SshHandler.csproj --configuration Release - --self-contained false /p:PublishSingleFile=true + --self-contained false + /p:PublishSingleFile=true -o ./publish-dotnet8 + # 2. Clean to prevent artifact leakage + - name: Clean intermediate files + run: dotnet clean SshHandler/SshHandler.csproj + + # 3. Build Standalone SECOND (The heavy one) + - name: Build Standalone (Includes Runtime) + run: > + dotnet publish SshHandler/SshHandler.csproj --configuration Release + --runtime win-x64 + --self-contained true + /p:PublishSingleFile=true + /p:IncludeNativeLibrariesForSelfExtract=true + -o ./publish-standalone + - name: Ensure Unix Line Endings for Shell Script shell: pwsh run: | @@ -48,7 +57,6 @@ jobs: $content = [System.IO.File]::ReadAllText((Get-Item $path).FullName) $content = $content -replace "`r`n", "`n" [System.IO.File]::WriteAllText((Get-Item $path).FullName, $content, (New-Object System.Text.UTF8Encoding($false))) - Write-Host "Successfully converted $path to LF" } - name: Prepare Assets with Versioning