Skip to content

Commit 17031f4

Browse files
committed
Enhance CI/CD workflow by creating an artifacts directory, improving artifact listing and verification, and updating the NuGet publishing process to handle multiple packages individually.
1 parent 928c1bf commit 17031f4

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

.github/workflows/publish.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,32 @@ jobs:
2121
with:
2222
dotnet-version: '8.0.x'
2323

24+
- name: Create artifacts directory
25+
run: New-Item -ItemType Directory -Force -Path ./artifacts
26+
2427
- name: Build and Pack
2528
run: dotnet pack --configuration Release --output ./artifacts
2629

27-
- name: Verify artifacts
30+
- name: List artifacts directory
2831
run: |
29-
if (Test-Path ./artifacts/*.nupkg) {
30-
Write-Host "Package files found:"
31-
Get-ChildItem ./artifacts/*.nupkg | ForEach-Object { Write-Host $_.FullName }
32+
Write-Host "Contents of artifacts directory:"
33+
Get-ChildItem ./artifacts -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName }
34+
Write-Host "Looking for .nupkg files:"
35+
$packages = Get-ChildItem ./artifacts -Filter *.nupkg -ErrorAction SilentlyContinue
36+
if ($packages) {
37+
Write-Host "Found $($packages.Count) package(s):"
38+
$packages | ForEach-Object { Write-Host $_.FullName }
3239
} else {
33-
Write-Host "No package files found in ./artifacts"
34-
Get-ChildItem ./artifacts -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName }
40+
Write-Host "ERROR: No .nupkg files found!"
3541
exit 1
3642
}
3743
3844
- name: Publish to NuGet
39-
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
45+
run: |
46+
$packages = Get-ChildItem ./artifacts -Filter *.nupkg
47+
foreach ($package in $packages) {
48+
Write-Host "Publishing $($package.Name)..."
49+
dotnet nuget push $package.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
50+
}
4051
4152

0 commit comments

Comments
 (0)