From 4eeb98ac2a70628b4010ad517315ca5e7205606c Mon Sep 17 00:00:00 2001 From: Rami Date: Tue, 10 Nov 2026 10:19:27 -0800 Subject: [PATCH] Use nuget.org Trusted Publishing in Build and Publish workflow (#1129) * Update GitHub Actions to Node.js 24 versions Node.js 20 is deprecated on GitHub Actions runners. Bump each action to the lowest major version that runs on Node.js 24: - actions/checkout v3/v4 -> v5 - actions/setup-dotnet v4 -> v5 - actions/setup-node v4 -> v5 - actions/upload-artifact v4 -> v6 - actions/download-artifact v4 -> v7 - dawidd6/action-download-artifact v8 -> v17 * Use nuget.org Trusted Publishing in Build and Publish workflow Replace the long-lived NUGET_API_KEY secret with a short-lived API key obtained from nuget.org via GitHub OIDC (NuGet/login). The key is passed to the Nuke build as NUGET_API_KEY, so nuke/Build.cs is unchanged. --- .github/workflows/Build and Publish.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Build and Publish.yml b/.github/workflows/Build and Publish.yml index 1b66603..f49e47a 100644 --- a/.github/workflows/Build and Publish.yml +++ b/.github/workflows/Build and Publish.yml @@ -6,7 +6,6 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} concurrency: group: build-publish-${{ github.ref }} @@ -23,6 +22,10 @@ jobs: timeout-minutes: 10 name: '2 / Publish' + permissions: + contents: write + id-token: write + steps: - uses: actions/checkout@v5 @@ -34,7 +37,15 @@ jobs: 8.0.x 10.0.x + - name: NuGet login + id: nuget-login + uses: NuGet/login@v1 + with: + user: ${{ secrets.NUGET_USER }} + - name: Build + env: + NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }} run: | if ($env:GITHUB_REF -eq "refs/heads/main") { .\build.ps1 -Target Publish