-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (47 loc) · 1.67 KB
/
deploy-nuget.yml
File metadata and controls
62 lines (47 loc) · 1.67 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
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Deploy to NuGet
on:
push:
branches: [ main ]
paths:
- 'GuardianClient/GuardianClient/**'
- '!GuardianClient/GuardianClient.Tests/**'
pull_request:
branches: [ main ]
paths:
- 'GuardianClient/GuardianClient/**'
- '!GuardianClient/GuardianClient.Tests/**'
env:
PROJECT_PATH: 'GuardianClient/GuardianClient/GuardianClient.csproj'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}
- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release
- name: Test
run: dotnet test ${{ env.PROJECT_PATH }} --no-build --configuration Release --verbosity normal
deploy:
needs: build-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}
- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release
- name: Pack
run: dotnet pack ${{ env.PROJECT_PATH }} --no-build --configuration Release --output ./artifacts
- name: Push to NuGet
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate