-
Notifications
You must be signed in to change notification settings - Fork 10
66 lines (54 loc) · 1.75 KB
/
build.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build and Test
on:
push:
branches: ['*']
pull_request:
jobs:
build:
name: Build and Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
dotnet-version: ['9.0.x']
include:
- os: macos-latest
arch: arm64
- os: ubuntu-latest
arch: x64
- os: windows-latest
arch: x64
steps:
- uses: actions/checkout@v4
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Run Tests
run: dotnet test --no-restore --verbosity normal
deploy:
name: Pack and Push NuGet Package
runs-on: windows-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Setup .NET 9.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore
- name: Pack NuGet Package
run: dotnet pack --configuration Release --no-build -o ./nupkgs
# version is picked up automatically from Directory.Build.props
- name: Push NuGet Package
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./nupkgs/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate