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: # Prevents git from automatically converting LF to CRLF during checkout autocrlf: input - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build and publish self-contained executable run: > dotnet publish --configuration Release --runtime win-x64 --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/') with: 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 }}