Compare commits

...

5 Commits

Author SHA1 Message Date
ergosteur
eab8873c14 Refactor GitHub Actions build workflow
Reorganize build steps for .NET project and add cleaning step.
2026-03-16 13:01:47 -04:00
ergosteur
1ead5e6d25 Configure Git line endings and enhance script checks
Added a step to configure Git line endings and improved the shell script to check for file existence before processing.
2026-03-16 12:54:47 -04:00
ergosteur
f1b35deb4e Update GitHub Actions workflow for .NET builds
add both stanadalone and .net builds, versioned filenames
2026-03-16 12:52:11 -04:00
ergosteur
478328896c Update GitHub Actions workflow for build and release
add shell script and batch file to release artifacts
2026-03-16 12:47:44 -04:00
ergosteur
cf7ead5f56 Modify build workflow for tagging and release
Updated workflow to trigger on version tags and added permissions for release creation.
2026-03-16 12:38:53 -04:00

View File

@@ -1,35 +1,89 @@
# .github/workflows/build.yml name: Build and Release
name: Build Windows Executable
on: on:
push: push:
branches: [ "main" ] # Runs whenever you push to the main branch tags:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab - 'v*'
workflow_dispatch:
jobs: jobs:
build: build:
runs-on: windows-latest # Use a Windows runner for the build runs-on: windows-latest
permissions:
contents: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Configure Git Line Endings
run: git config --global core.autocrlf input
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v4 uses: actions/setup-dotnet@v4
with: with:
dotnet-version: 8.0.x # Use a recent .NET version dotnet-version: 8.0.x
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore
- name: Build and publish self-contained executable # 1. Build Framework-Dependent FIRST (The tiny one)
run: > # This command builds a single .exe with the runtime included - name: Build Framework-Dependent (Requires .NET 8)
dotnet publish --configuration Release --runtime win-x64 run: >
--self-contained true /p:PublishSingleFile=true dotnet publish SshHandler/SshHandler.csproj --configuration Release
/p:IncludeNativeLibrariesForSelfExtract=true --self-contained false
/p:PublishSingleFile=true
-o ./publish-dotnet8
- name: Upload artifact # 2. Clean to prevent artifact leakage
uses: actions/upload-artifact@v4 - 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: |
$path = "ssh-handler.sh"
if (Test-Path $path) {
$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)))
}
- name: Prepare Assets with Versioning
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
if (-not $tag -or $tag -eq "main") { $tag = "manual" }
# Rename Executables
Move-Item ./publish-standalone/SshHandler.exe "./SshHandler-$tag-Standalone.exe"
Move-Item ./publish-dotnet8/SshHandler.exe "./SshHandler-$tag-dotnet8.exe"
# Rename Scripts
Copy-Item "ssh-handler.sh" "./ssh-handler-$tag.sh"
Copy-Item "openssh_protocol_handler.bat" "./openssh_protocol_handler-$tag.bat"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with: with:
name: SshHandler-Windows-Executable # The name of the downloadable file files: |
path: ${{ github.workspace }}/SshHandler/bin/Release/net8.0-windows/win-x64/publish/SshHandler.exe # Adjust the path if your project name is different SshHandler-*-Standalone.exe
SshHandler-*-dotnet8.exe
ssh-handler-*.sh
openssh_protocol_handler-*.bat
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}