Skip to content

Commit d5418bc

Browse files
committed
Update nuget gha.
1 parent 3803ad2 commit d5418bc

1 file changed

Lines changed: 53 additions & 29 deletions

File tree

.github/workflows/nuget.yml

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,75 @@ on:
66
- 'v*' # Triggers on tag pushes starting with 'v'
77

88
jobs:
9-
build-and-publish:
10-
strategy:
11-
matrix:
12-
framework: ['net10.0']
9+
pack-cross-platform:
1310
runs-on: ubuntu-latest
1411
steps:
15-
# Checkout the repository
16-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1713

18-
# Set up .NET SDK
19-
- uses: actions/setup-dotnet@v2
14+
- uses: actions/setup-dotnet@v4
2015
with:
2116
dotnet-version: '10.0.x'
2217

23-
# Restore dependencies
24-
- name: Restore dependencies
25-
run: dotnet restore Libraries.slnf
26-
27-
# Build the projects
28-
- name: Build
29-
run: dotnet build Libraries.slnf -c Release --no-restore
30-
31-
# Run unit tests
18+
# Unit tests only need the cross-platform libs
3219
- name: Unit tests
33-
run: dotnet test test/unit/SIPSorcery.UnitTests.csproj --framework ${{ matrix.framework }} -c Release
20+
run: dotnet test test/unit/SIPSorcery.UnitTests.csproj --framework net10.0 -c Release
3421

35-
# Pack the NuGet packages
36-
- name: Pack NuGet SIPSorcery package
22+
- name: Pack SIPSorcery
3723
run: dotnet pack src/SIPSorcery/SIPSorcery.csproj -c Release -o ./artifacts
38-
- name: Pack NuGet SIPSorceryMedia.Abstractions package
24+
25+
- name: Pack SIPSorceryMedia.Abstractions
3926
run: dotnet pack src/SIPSorceryMedia.Abstractions/SIPSorceryMedia.Abstractions.csproj -c Release -o ./artifacts
40-
- name: Pack NuGet SIPSorceryMedia.Windows package
41-
run: dotnet pack src/SIPSorceryMedia.Windows/SIPSorceryMedia.Windows.csproj -c Release -o ./artifacts
42-
- name: Pack NuGet SIPSorceryMedia.FFmpeg package
27+
28+
- name: Pack SIPSorceryMedia.FFmpeg
4329
run: dotnet pack src/SIPSorceryMedia.FFmpeg/SIPSorceryMedia.FFmpeg.csproj -c Release -o ./artifacts
44-
- name: Pack NuGet SIPSorcery.OpenAI.Realtime package
30+
31+
- name: Pack SIPSorcery.OpenAI.Realtime
4532
run: dotnet pack src/SIPSorcery.OpenAI.Realtime/SIPSorcery.OpenAI.Realtime.csproj -c Release -o ./artifacts
4633

47-
# Publish to NuGet
48-
- name: Publish NuGet packageS
49-
if: startsWith(github.ref, 'refs/tags/v') # Only run on tag pushes
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+
49+
- name: Pack SIPSorceryMedia.Windows
50+
run: dotnet pack src/SIPSorceryMedia.Windows/SIPSorceryMedia.Windows.csproj -c Release -o ./artifacts
51+
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'
72+
73+
- name: Publish all packages to NuGet
5074
env:
5175
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
5276
run: |
5377
dotnet nuget push ./artifacts/*.nupkg \
5478
--source https://api.nuget.org/v3/index.json \
5579
--api-key $NUGET_API_KEY \
56-
--skip-duplicate
80+
--skip-duplicate

0 commit comments

Comments
 (0)