Refactor GitHub Actions build workflow

Reorganize build steps for .NET project and add cleaning step.
This commit is contained in:
ergosteur
2026-03-16 13:01:47 -04:00
committed by GitHub
parent 1ead5e6d25
commit eab8873c14

View File

@@ -16,7 +16,6 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
# This replaces the invalid 'autocrlf' input
- name: Configure Git Line Endings - name: Configure Git Line Endings
run: git config --global core.autocrlf input run: git config --global core.autocrlf input
@@ -28,18 +27,28 @@ jobs:
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore
- name: Build Standalone (Includes Runtime) # 1. Build Framework-Dependent FIRST (The tiny one)
run: >
dotnet publish SshHandler/SshHandler.csproj --configuration Release --runtime win-x64
--self-contained true /p:PublishSingleFile=true
-o ./publish-standalone
- name: Build Framework-Dependent (Requires .NET 8) - name: Build Framework-Dependent (Requires .NET 8)
run: > run: >
dotnet publish SshHandler/SshHandler.csproj --configuration Release dotnet publish SshHandler/SshHandler.csproj --configuration Release
--self-contained false /p:PublishSingleFile=true --self-contained false
/p:PublishSingleFile=true
-o ./publish-dotnet8 -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 - name: Ensure Unix Line Endings for Shell Script
shell: pwsh shell: pwsh
run: | run: |
@@ -48,7 +57,6 @@ jobs:
$content = [System.IO.File]::ReadAllText((Get-Item $path).FullName) $content = [System.IO.File]::ReadAllText((Get-Item $path).FullName)
$content = $content -replace "`r`n", "`n" $content = $content -replace "`r`n", "`n"
[System.IO.File]::WriteAllText((Get-Item $path).FullName, $content, (New-Object System.Text.UTF8Encoding($false))) [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 - name: Prepare Assets with Versioning