diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b6af31e1..ffdd8a24 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,6 +12,10 @@ env: jobs: build: runs-on: ubuntu-latest + environment: Production + permissions: + contents: write + id-token: write steps: - uses: actions/checkout@v7 - name: Check github.ref starts with 'refs/tags/' @@ -32,9 +36,6 @@ jobs: with: dotnet-version: | 8.0.x - source-url: https://api.nuget.org/v3/index.json - env: - NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}} - name: Install dependencies run: dotnet restore - name: Build solution [Release] @@ -47,8 +48,15 @@ jobs: name: Nuget packages path: | out/* + - name: Log in to NuGet.org + uses: NuGet/login@v1 + id: nuget-login + with: + user: ${{ vars.NUGET_USER }} - name: Publish Nuget packages to Nuget registry - run: dotnet nuget push "out/*" -k ${{secrets.NUGET_AUTH_TOKEN}} + env: + NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }} + run: dotnet nuget push "out/*" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" - name: Upload Nuget packages as release artifacts uses: actions/github-script@v9 with: