mirror of
https://github.com/ergosteur/ssh-protocol-handler-win.git
synced 2026-04-19 13:39:33 -04:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eab8873c14 | ||
|
|
1ead5e6d25 | ||
|
|
f1b35deb4e | ||
|
|
478328896c |
70
.github/workflows/build.yml
vendored
70
.github/workflows/build.yml
vendored
@@ -3,19 +3,22 @@ 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
|
||||
|
||||
- name: Configure Git Line Endings
|
||||
run: git config --global core.autocrlf input
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
@@ -24,26 +27,63 @@ jobs:
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build and publish self-contained executable
|
||||
# 1. Build Framework-Dependent FIRST (The tiny one)
|
||||
- name: Build Framework-Dependent (Requires .NET 8)
|
||||
run: >
|
||||
dotnet publish --configuration Release --runtime win-x64
|
||||
--self-contained true /p:PublishSingleFile=true
|
||||
dotnet publish SshHandler/SshHandler.csproj --configuration Release
|
||||
--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: |
|
||||
$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/') # 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: |
|
||||
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 }}
|
||||
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user