Skip to content

Commit f1406b7

Browse files
JusterZhuclaude
andcommitted
fix: use NuGet Trusted Publishing (OIDC) instead of API key
Remove --api-key parameter and add id-token: write permission for NuGet.org Trusted Publishing. This eliminates the empty API key error and follows NuGet's recommended OIDC authentication for GitHub Actions. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent acc3e68 commit f1406b7

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

.github/workflows/publish-nuget.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ on:
77
description: 'NuGet package version (SemVer 2.0, e.g. 1.0.0, 1.0.0-beta.1)'
88
required: true
99
type: string
10-
push-to-nuget:
11-
description: 'Push package to NuGet.org'
12-
required: false
13-
type: boolean
14-
default: true
1510

1611
permissions:
1712
contents: write
13+
id-token: write
1814

1915
jobs:
2016
publish:
@@ -77,10 +73,8 @@ jobs:
7773
--notes "Release of GeneralUpdate.Avalonia version **${{ inputs.version }}**" \
7874
--verify-tag
7975
80-
- name: Push NuGet package
81-
if: ${{ inputs.push-to-nuget == true }}
76+
- name: Push NuGet package to NuGet.org (Trusted Publishing via OIDC)
8277
run: |
8378
dotnet nuget push artifacts/*.nupkg \
84-
--api-key ${{ secrets.NUGET_API_KEY }} \
8579
--source https://api.nuget.org/v3/index.json \
8680
--skip-duplicate

0 commit comments

Comments
 (0)