-
Notifications
You must be signed in to change notification settings - Fork 442
executable file
·47 lines (39 loc) · 1.31 KB
/
nuget.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Publish to Nuget
on:
push:
tags:
- 'v*' # Triggers on tag pushes starting with 'v'
jobs:
build-and-publish:
strategy:
matrix:
framework: ['net8.0']
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v2
# Set up .NET SDK
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
# Restore dependencies
- name: Restore dependencies
run: dotnet restore src/SIPSorcery.csproj
# Build the project
- name: Build
run: dotnet build src/SIPSorcery.csproj -c Release --no-restore
# Run unit tests
- name: Unit tests
run: dotnet test test/unit/SIPSorcery.UnitTests.csproj --framework ${{ matrix.framework }} -c Release
# Pack the NuGet package
- name: Pack NuGet package
run: dotnet pack src/SIPSorcery.csproj -c Release -o ./artifacts
# Publish to NuGet
- name: Publish NuGet package
if: startsWith(github.ref, 'refs/tags/v') # Only run on tag pushes
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
dotnet nuget push ./artifacts/*.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key $NUGET_API_KEY