From 4d756d445c9a6978fe03234f2d85a4d3dcd6cca1 Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Tue, 19 Nov 2024 17:00:18 +0100 Subject: [PATCH] Publish NuGet package to GitHub Registry only on develop branch. --- .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ README.md | 13 +++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50b98f839..6e4b721d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -137,3 +137,29 @@ jobs: with: name: Coverlet Results Windows path: coverlet + + Publish: + runs-on: ubuntu-24.04 + if: github.ref == 'refs/heads/develop' + permissions: + packages: write + needs: + - Windows + - Linux + steps: + - name: Download NuGet Package + uses: actions/download-artifact@v4 + with: + name: NuGet Package + + - name: Publish to GitHub NuGet Registry + run: | + dotnet nuget add source \ + --username $GITHUB_ACTOR \ + --password ${{ secrets.GITHUB_TOKEN }} \ + --store-password-in-clear-text \ + --name github \ + "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" + dotnet nuget push "*.nupkg" \ + --source github \ + --api-key ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 3d8212813..60a7e5b8c 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,19 @@ Private keys in OpenSSH key format can be encrypted using one of the following c The library has no special requirements to build, other than an up-to-date .NET SDK. See also [CONTRIBUTING.md](https://github.com/sshnet/SSH.NET/blob/develop/CONTRIBUTING.md). +## Using Pre-Release NuGet Package + +If you need an unreleased bugfix or feature, you can use the Pre-Release NuGet packages from the `develop` branch which are published to the [GitHub NuGet Registry](https://github.com/sshnet/SSH.NET/pkgs/nuget/SSH.NET). +In order to pull packages from the registry you first have to create a Personal Access Token with the `read:packages` permissions. Then add a NuGet Source for SSH.NET: + +Note: you may have to add `--store-password-in-clear-text` on non-Windows platforms. + +``` +dotnet nuget add source --name SSH.NET --username --password https://nuget.pkg.github.com/sshnet/index.json +``` + +Then you can add the the package as desribed [here](https://github.com/sshnet/SSH.NET/pkgs/nuget/SSH.NET). + ## Supporting SSH.NET Do you or your company rely on **SSH.NET** in your projects? If you want to encourage us to keep on going and show us that you appreciate our work, please consider becoming a [sponsor](https://github.com/sponsors/sshnet) through GitHub Sponsors.