Update GitHub Actions workflow for build and release

add shell script and batch file to release artifacts
This commit is contained in:
ergosteur
2026-03-16 12:47:44 -04:00
committed by GitHub
parent cf7ead5f56
commit 478328896c

View File

@@ -3,18 +3,21 @@ name: Build and Release
on:
push:
tags:
- 'v*' # Triggers only on tags starting with 'v' (e.g., v1.0.0)
workflow_dispatch: # Allows manual runs from the Actions tab
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
permissions:
contents: write # Essential for creating the release and uploading assets
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Prevents git from automatically converting LF to CRLF during checkout
autocrlf: input
- name: Setup .NET
uses: actions/setup-dotnet@v4
@@ -30,20 +33,25 @@ jobs:
--self-contained true /p:PublishSingleFile=true
/p:IncludeNativeLibrariesForSelfExtract=true
- name: Ensure Unix Line Endings for Shell Script
shell: pwsh
run: |
$path = "ssh-handler.sh"
$content = Get-Content -Raw $path
# Replace CRLF with LF just in case
$content = $content -replace "`r`n", "`n"
[System.IO.File]::WriteAllText((Get-Item $path).FullName, $content, (New-Object System.Text.UTF8Encoding($false)))
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') # Only runs if the trigger was a tag
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.workspace }}/SshHandler/bin/Release/net8.0-windows/win-x64/publish/SshHandler.exe
files: |
${{ github.workspace }}/SshHandler/bin/Release/net8.0-windows/win-x64/publish/SshHandler.exe
ssh-handler.sh
openssh_protocol_handler.bat
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact (Manual Run fallback)
uses: actions/upload-artifact@v4
if: always() # Still uploads the artifact even if it wasn't a tag run
with:
name: SshHandler-Windows-Executable
path: ${{ github.workspace }}/SshHandler/bin/Release/net8.0-windows/win-x64/publish/SshHandler.exe