-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (53 loc) · 2.1 KB
/
publish-to-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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Publish Packages
on:
push:
branches: [ "main" ]
paths:
- 'src/**'
- 'LICENSE'
- 'README.md'
pull_request:
branches: [ main ]
jobs:
Build-Tests-Publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: logic_modified # check if the logic or LICENCE or README.md are changed
uses: pheel/path-watcher-action@v1
with:
paths: 'src/Spoleto.Common/**,LICENSE,README.md'
- id: logic_tests_modified # check if the logic or tests are changed
uses: pheel/path-watcher-action@v1
with:
paths: 'src/Spoleto.Common/**,src/*.Tests/**'
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- if: steps.logic_tests_modified.outputs.modified # run this step if there are changes in the logic or tests
name: Test with the dotnet CLI
run: dotnet test --no-restore --logger "trx;LogFileName=test-results.trx"
- if: steps.logic_tests_modified.outputs.modified && ( success() || failure() ) # run this step if there are changes in the logic or tests and even previous step failed
name: Tests report
uses: dorny/[email protected]
with:
name: Test results
path: '**/test-results.trx'
reporter: dotnet-trx
- if: steps.logic_modified.outputs.modified # run this step if there are changes in the logic or LICENCE or README.md
name: Publish to Nuget
uses: alirezanet/[email protected]
with:
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: src/Spoleto.Common/Spoleto.Common.csproj
# API key to authenticate with NuGet server
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default
INCLUDE_SYMBOLS: true
# Flag to toggle git tagging, enabled by default
TAG_COMMIT: false