Skip to content

Commit 0915341

Browse files
authored
Fix NuGet publish workflow: handle invalid/missing API key gracefully
1 parent 6aacc91 commit 0915341

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.github/workflows/nuget.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ jobs:
2424
- name: List nupkg
2525
run: dir .\nupkgs
2626
- name: Push NuGet package
27+
if: ${{ secrets.NUGET_API_KEY }}
28+
env:
29+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
2730
run: |
2831
$version = "${{ github.ref_name }}" -replace '^v', ''
2932
$pkg = Get-ChildItem -Path ./nupkgs -Filter "*$version.nupkg" | Select-Object -First 1
30-
dotnet nuget push $pkg.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
33+
dotnet nuget push $pkg.FullName --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)