Skip to content

Commit b56bde3

Browse files
committed
chore(ci): switch NuGet publish job to trusted publishing
1 parent be13e9e commit b56bde3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
runs-on: ubuntu-latest
8282
permissions:
8383
contents: read
84+
id-token: write
8485

8586
steps:
8687
- name: Download NuGet package artifact
@@ -95,9 +96,15 @@ jobs:
9596
- name: Display package information
9697
run: Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg | ForEach-Object { $_.FullName }
9798

99+
- name: NuGet login (OIDC -> temp API key)
100+
uses: NuGet/login@v1
101+
id: login
102+
with:
103+
user: Agash
104+
98105
- name: Publish NuGet package to NuGet.org
99106
run: |
100107
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
101108
Write-Host "Pushing package: $($file.FullName)"
102-
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
109+
dotnet nuget push $file --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
103110
}

0 commit comments

Comments
 (0)