Files
ssh-protocol-handler-win/.github/workflows/build.yml
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

77 lines
2.2 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
autocrlf: input
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- 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
- name: Build Framework-Dependent (Requires .NET 8)
run: >
dotnet publish SshHandler/SshHandler.csproj --configuration Release
--self-contained false /p:PublishSingleFile=true
-o ./publish-dotnet8
- name: Ensure Unix Line Endings for Shell Script
shell: pwsh
run: |
$path = "ssh-handler.sh"
$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) { $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:
files: |
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 }}