-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (46 loc) · 1.3 KB
/
dotnet.yml
File metadata and controls
49 lines (46 loc) · 1.3 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
48
49
name: Build and Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [ "created" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Restore Dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-restore --no-build --verbosity normal
release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Restore Dependencies
run: dotnet restore
- name: Pack NuGet Package
run: dotnet pack --no-restore -c Release -o ./artifacts
- name: Upload NuGet Artifact
uses: actions/upload-artifact@v4
with:
name: Packages
path: ./artifacts/*.nupkg
- name: Publish to NuGet
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