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.
This commit is contained in:
Rami
2026-11-10 10:19:27 -08:00
committed by GitHub
parent 52d42b891d
commit 4eeb98ac2a

View File

@@ -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