Skip to content

Commit 7c152d8

Browse files
JusterZhuclaude
andcommitted
fix: add OIDC token fetch for NuGet Trusted Publishing
NuGet.org Trusted Publishing requires an OIDC JWT token as --api-key. The token is fetched from the Actions runtime using ACTIONS_ID_TOKEN_REQUEST_URL with audience=nuget. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0656461 commit 7c152d8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

.github/workflows/publish-nuget.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ jobs:
8686
- name: Push NuGet package to NuGet.org (Trusted Publishing via OIDC)
8787
if: ${{ inputs.push-to-nuget == true }}
8888
run: |
89+
ID_TOKEN=$(curl -sSL -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
90+
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=nuget" | jq -r '.value')
8991
dotnet nuget push artifacts/*.nupkg \
9092
--source https://api.nuget.org/v3/index.json \
93+
--api-key "$ID_TOKEN" \
9194
--skip-duplicate

0 commit comments

Comments
 (0)