From 04cf4082bbb55e7bb5ad5ddec66b3f0aecddb282 Mon Sep 17 00:00:00 2001 From: Konstantin Diachenko Date: Sun, 26 Jan 2025 20:42:00 +0530 Subject: [PATCH] Fix https://github.com/linksplatform/Data.Doublets.Sequences/issues/33 --- .github/workflows/csharp.yml | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/.github/workflows/csharp.yml b/.github/workflows/csharp.yml index 0aeb023..6d39823 100644 --- a/.github/workflows/csharp.yml +++ b/.github/workflows/csharp.yml @@ -24,28 +24,59 @@ jobs: submodules: true - name: Test run: | - dotnet test -c Release -f net8 - pushNuGetPackageToGitHubPackageRegistry: - needs: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - with: - submodules: true + dotnet test -c Release -f net8name: Publish NuGet Package + +on: + push: + branches: + - main + tags: + - 'v*.*.*' + +jobs: + pushNuGetPackageToGitHubPackageRegistry: + needs: test + runs-on: ubuntu-latest + steps: + # 1. Checkout the repository + - uses: actions/checkout@v3 + with: + submodules: true + + # 2. Setup .NET SDK - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '8.0.x' + dotnet-version: '8.0.x' # Specify your required .NET version + + # 3. Restore dependencies - name: Restore dependencies run: dotnet restore + + # 4. Build the project - name: Build run: dotnet build --configuration Release --no-restore + + # 5. Pack the project into a NuGet package - name: Pack run: dotnet pack --configuration Release --no-restore --output ./nupkgs - - name: Push NuGet package to GitHub Package Registry + + # 6. Add GitHub Package Registry as a NuGet source + - name: Add GitHub Package Registry as NuGet Source + run: | + dotnet nuget add source "https://nuget.pkg.github.com/linksplatform/index.json" \ + --name "GitHub" \ + --username "linksplatform" \ + --password "${{ secrets.GITHUB_TOKEN }}" \ + --store-password-in-clear-text + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # 7. Push the NuGet package to GitHub Package Registry + - name: Push NuGet Package to GitHub Package Registry run: | dotnet nuget push ./nupkgs/*.nupkg \ - --source "github" \ + --source "GitHub" \ --api-key "${{ secrets.GITHUB_TOKEN }}" env: NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}