diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 5a9dbac..2f65e86 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -9,6 +9,9 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 @@ -20,6 +23,12 @@ jobs: run: dotnet restore - name: Build run: dotnet build --configuration Release --no-restore + - name: NuGet login (OIDC) + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: NuGet/login@v1 + id: nuget-login + with: + user: ${{ secrets.NUGET_USER }} - name: Publish NuGet if: github.event_name == 'push' && github.ref == 'refs/heads/main' - run: dotnet nuget push AzureFunctionsUtils/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + run: dotnet nuget push AzureFunctionsUtils/bin/Release/*.nupkg --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate