From f1bc309801d4925f4703bb64ca1af3b1ec6f6d9b Mon Sep 17 00:00:00 2001 From: Ilya Kochetkov Date: Sun, 26 Jul 2026 19:35:34 +0400 Subject: [PATCH] Update CI/CD workflow for NuGet package publishing Added permissions for contents and id-token in CI/CD workflow. Updated NuGet login step to use OIDC and modified the push command to reference the new login output. --- .github/workflows/ci-cd.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 3e5a169..3c49b47 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -8,6 +8,10 @@ on: pull_request: branches: [ main ] +permissions: + contents: read + id-token: write + jobs: test: name: Run Integration Tests @@ -49,9 +53,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x - - - name: Pack NuGet Package - run: dotnet pack src/IlyaKo.AspNet.SideAuth/IlyaKo.AspNet.SideAuth.csproj --configuration Release --output ./output - name: Extract Version from Tag id: get_version @@ -65,9 +66,15 @@ jobs: /p:PackageVersion=${{ env.VERSION }} \ /p:Version=${{ env.VERSION }} + - name: NuGet Login (OIDC) + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_ORG_LOGIN }} + - name: Push to NuGet.org run: | dotnet nuget push ./output/*.nupkg \ - --api-key ${{ secrets.NUGET_API_KEY }} \ + --api-key ${{ steps.login.outputs.NUGET_API_KEY }} \ --source https://api.nuget.org/v3/index.json \ --skip-duplicate