-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (37 loc) · 1.32 KB
/
main.yml
File metadata and controls
47 lines (37 loc) · 1.32 KB
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: Build, Test, and Publish to NuGet
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x' # Adjust this to the version of .NET your project uses
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --configuration Release --no-restore
- name: Run tests
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack project
run: dotnet pack --configuration Release --no-build --output ./nupkg --include-symbols --include-source
- name: Publish to NuGet
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
# Push the standard package
dotnet nuget push ./nupkg/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
# Push the symbol package to the NuGet symbol server
dotnet nuget push ./nupkg/*.snupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate