Skip to content

Commit e00dbae

Browse files
committed
Update nuget gha.
1 parent d5418bc commit e00dbae

1 file changed

Lines changed: 11 additions & 44 deletions

File tree

.github/workflows/nuget.yml

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ on:
66
- 'v*' # Triggers on tag pushes starting with 'v'
77

88
jobs:
9-
pack-cross-platform:
10-
runs-on: ubuntu-latest
9+
build-test-pack:
10+
runs-on: windows-latest
1111
steps:
1212
- uses: actions/checkout@v4
1313

1414
- uses: actions/setup-dotnet@v4
1515
with:
1616
dotnet-version: '10.0.x'
1717

18-
# Unit tests only need the cross-platform libs
18+
# Unit tests
1919
- name: Unit tests
2020
run: dotnet test test/unit/SIPSorcery.UnitTests.csproj --framework net10.0 -c Release
2121

22+
# Pack all NuGet packages (Windows can build all target frameworks incl. net462 and net10.0-windows)
2223
- name: Pack SIPSorcery
2324
run: dotnet pack src/SIPSorcery/SIPSorcery.csproj -c Release -o ./artifacts
2425

@@ -28,53 +29,19 @@ jobs:
2829
- name: Pack SIPSorceryMedia.FFmpeg
2930
run: dotnet pack src/SIPSorceryMedia.FFmpeg/SIPSorceryMedia.FFmpeg.csproj -c Release -o ./artifacts
3031

31-
- name: Pack SIPSorcery.OpenAI.Realtime
32-
run: dotnet pack src/SIPSorcery.OpenAI.Realtime/SIPSorcery.OpenAI.Realtime.csproj -c Release -o ./artifacts
33-
34-
- name: Upload cross-platform artifacts
35-
uses: actions/upload-artifact@v4
36-
with:
37-
name: nuget-cross-platform
38-
path: ./artifacts/*.nupkg
39-
40-
pack-windows:
41-
runs-on: windows-latest
42-
steps:
43-
- uses: actions/checkout@v4
44-
45-
- uses: actions/setup-dotnet@v4
46-
with:
47-
dotnet-version: '10.0.x'
48-
4932
- name: Pack SIPSorceryMedia.Windows
5033
run: dotnet pack src/SIPSorceryMedia.Windows/SIPSorceryMedia.Windows.csproj -c Release -o ./artifacts
5134

52-
- name: Upload Windows artifacts
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: nuget-windows
56-
path: ./artifacts/*.nupkg
57-
58-
publish:
59-
needs: [pack-cross-platform, pack-windows]
60-
runs-on: ubuntu-latest
61-
if: startsWith(github.ref, 'refs/tags/v')
62-
steps:
63-
- uses: actions/download-artifact@v4
64-
with:
65-
pattern: nuget-*
66-
path: ./artifacts
67-
merge-multiple: true
68-
69-
- uses: actions/setup-dotnet@v4
70-
with:
71-
dotnet-version: '10.0.x'
35+
- name: Pack SIPSorcery.OpenAI.Realtime
36+
run: dotnet pack src/SIPSorcery.OpenAI.Realtime/SIPSorcery.OpenAI.Realtime.csproj -c Release -o ./artifacts
7237

38+
# Publish to NuGet (only on tag pushes)
7339
- name: Publish all packages to NuGet
40+
if: startsWith(github.ref, 'refs/tags/v')
7441
env:
7542
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
7643
run: |
77-
dotnet nuget push ./artifacts/*.nupkg \
78-
--source https://api.nuget.org/v3/index.json \
79-
--api-key $NUGET_API_KEY \
44+
dotnet nuget push ./artifacts/*.nupkg `
45+
--source https://api.nuget.org/v3/index.json `
46+
--api-key $env:NUGET_API_KEY `
8047
--skip-duplicate

0 commit comments

Comments
 (0)