Skip to content

Commit 400c0e5

Browse files
committed
Update CI/CD workflow to run on Ubuntu, make package version input optional, and streamline artifact listing and publishing steps.
1 parent 17031f4 commit 400c0e5

1 file changed

Lines changed: 17 additions & 25 deletions

File tree

.github/workflows/publish.yml

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
inputs:
88
version:
99
description: 'Package version (e.g., 1.0.0)'
10-
required: true
10+
required: false
1111

1212
jobs:
1313
publish:
14-
runs-on: windows-latest
14+
runs-on: ubuntu-latest
1515

1616
steps:
1717
- uses: actions/checkout@v4
@@ -21,32 +21,24 @@ jobs:
2121
with:
2222
dotnet-version: '8.0.x'
2323

24-
- name: Create artifacts directory
25-
run: New-Item -ItemType Directory -Force -Path ./artifacts
24+
- name: Build
25+
run: dotnet build --configuration Release
2626

27-
- name: Build and Pack
28-
run: dotnet pack --configuration Release --output ./artifacts
27+
- name: Pack
28+
run: dotnet pack --configuration Release --no-build --output ./artifacts
2929

30-
- name: List artifacts directory
30+
- name: List packages
3131
run: |
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 }
39-
} else {
40-
Write-Host "ERROR: No .nupkg files found!"
41-
exit 1
42-
}
32+
echo "Contents of artifacts directory:"
33+
ls -la ./artifacts/ || echo "Directory not found"
34+
echo "Looking for .nupkg files:"
35+
find ./artifacts -name "*.nupkg" 2>/dev/null || echo "No packages found"
4336
4437
- name: Publish to NuGet
4538
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-
}
51-
52-
39+
for package in ./artifacts/*.nupkg; do
40+
if [ -f "$package" ]; then
41+
echo "Publishing $package..."
42+
dotnet nuget push "$package" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
43+
fi
44+
done

0 commit comments

Comments
 (0)