4747 - name : Pack NuGet package
4848 run : dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./packages
4949
50+ - name : List packages for debugging
51+ run : Get-ChildItem -Path "./packages" -Recurse
52+
5053 - name : Upload NuGet package as artifact
5154 uses : actions/upload-artifact@v4
5255 with :
@@ -70,12 +73,25 @@ jobs:
7073 with :
7174 dotnet-version : ${{ env.DOTNET_VERSION }}
7275
76+ - name : Verify packages exist
77+ run : |
78+ if (-not (Test-Path "./packages/*.nupkg")) {
79+ Write-Error "No .nupkg files found in ./packages directory"
80+ Get-ChildItem -Path "./packages" -Recurse
81+ exit 1
82+ }
83+ Write-Host "Found packages:"
84+ Get-ChildItem -Path "./packages" -Filter "*.nupkg"
85+
7386 - name : Publish NuGet package
7487 run : |
75- dotnet nuget push ./packages/*.nupkg `
76- --api-key ${{ secrets.NUGET_API_KEY }} `
77- --source https://api.nuget.org/v3/index.json `
78- --skip-duplicate
88+ $nupkgFiles = Get-ChildItem -Path "./packages" -Filter "*.nupkg"
89+ foreach ($file in $nupkgFiles) {
90+ dotnet nuget push $file.FullName `
91+ --api-key ${{ secrets.NUGET_API_KEY }} `
92+ --source https://api.nuget.org/v3/index.json `
93+ --skip-duplicate
94+ }
7995 env :
8096 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
8197
@@ -96,11 +112,24 @@ jobs:
96112 with :
97113 dotnet-version : ${{ env.DOTNET_VERSION }}
98114
115+ - name : Verify packages exist
116+ run : |
117+ if (-not (Test-Path "./packages/*.nupkg")) {
118+ Write-Error "No .nupkg files found in ./packages directory"
119+ Get-ChildItem -Path "./packages" -Recurse
120+ exit 1
121+ }
122+ Write-Host "Found packages:"
123+ Get-ChildItem -Path "./packages" -Filter "*.nupkg"
124+
99125 - name : Publish to GitHub Packages
100126 run : |
101- dotnet nuget push ./packages/*.nupkg `
102- --api-key ${{ secrets.GITHUB_TOKEN }} `
103- --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
104- --skip-duplicate
127+ $nupkgFiles = Get-ChildItem -Path "./packages" -Filter "*.nupkg"
128+ foreach ($file in $nupkgFiles) {
129+ dotnet nuget push $file.FullName `
130+ --api-key ${{ secrets.GITHUB_TOKEN }} `
131+ --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
132+ --skip-duplicate
133+ }
105134 env :
106135 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments