Skip to content

Commit 4ddaf24

Browse files
Refactor NuGet publish step to handle multiple packages
1 parent 40a2351 commit 4ddaf24

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,14 @@ jobs:
142142
- name: Publish to NuGet.org
143143
shell: pwsh
144144
run: |
145-
dotnet nuget push "${{ github.workspace }}/nupkg/*.nupkg" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
145+
$packages = Get-ChildItem -Path "${{ github.workspace }}/nupkg" -Filter *.nupkg
146+
foreach ($package in $packages) {
147+
Write-Host "Going to publish $($package.Name)"
148+
dotnet nuget push $package.FullName --api-key ${{ steps.nuget-login.outputs.nuget-api-key }} --source https://api.nuget.org/v3/index.json
149+
if ($LASTEXITCODE -ne 0) {
150+
throw "Failed to publish $($package.Name)"
151+
}
152+
}
146153
147154
- name: Clean up certificate
148155
if: always()

0 commit comments

Comments
 (0)