Skip to content

Commit e7e972f

Browse files
JusterZhuclaude
andcommitted
fix(ci): switch NuGet push to Trusted Publishing (OIDC)
- Add id-token: write permission for nuget.org OIDC - Replace API-key push with OIDC-compatible placeholder api-key - This allows pushing to nuget.org without storing secrets Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 55b160c commit e7e972f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/dotnet-ci.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
jobs:
1212
build-and-publish:
1313
runs-on: windows-latest
14+
permissions:
15+
contents: write # 创建 Release
16+
id-token: write # 用于 nuget.org Trusted Publishing (OIDC)
1417
steps:
1518
- name: 检出代码
1619
uses: actions/checkout@v6
@@ -60,13 +63,11 @@ jobs:
6063
foreach ($nupkg in $nupkgs) {
6164
Write-Host "推送 $($nupkg.Name)..."
6265
dotnet nuget push $nupkg.FullName `
63-
--api-key ${{ secrets.NUGET_API_KEY }} `
66+
--api-key azure `
6467
--source https://api.nuget.org/v3/index.json `
6568
--skip-duplicate
6669
}
6770
shell: pwsh
68-
env:
69-
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
7071

7172
- name: 生成更新日志
7273
shell: pwsh

0 commit comments

Comments
 (0)