-
-
Notifications
You must be signed in to change notification settings - Fork 178
75 lines (65 loc) · 2.22 KB
/
dotnetcore.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
67
68
69
70
71
72
73
74
75
name: .NET Core
on:
# Run on all PRs
pull_request:
# Run when:
# - The main branch is pushed to, i.e. a PR targeting main is merged
# - The repo is tagged
push:
branches:
- main
tags:
- '*'
jobs:
build:
name: Github Actions Build
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.*
- name: Build Reason
run: echo ${{github.ref}} and ${{github.event_name}}
- name: Build with dotnet
run: >-
dotnet build
--configuration Release
--nologo
- name: Run tests
run: >-
dotnet test
--configuration Release
--logger trx
--no-build
--nologo
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: .NET tests
path: '**/*.trx'
reporter: dotnet-trx
# PR merged or main tag created, create the CarterTemplate NuGet package
- if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/newtonsoft-')
name: Create Carter template NuGet package
run: >-
dotnet pack ./template/Template.csproj
--configuration Release
--nologo
# PR merged, push prelease and CarterTemplate Carter packages to feedz
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads')
name: Push prelease and CarterTemplate Carter packages to feedz
run: ./push.sh carter feedz ${{ secrets.FEEDZ_KEY }}
# Main tag created, push Carter and CarterTemplate packages to NuGet
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && !startsWith(github.ref, 'refs/tags/newtonsoft-')
name: Push Carter and CarterTemplate packages to NuGet
run: ./push.sh carter nuget ${{ secrets.NUGET_KEY }}
# Newtonsoft tag created, push Newtonsoft package to NuGet
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && startsWith(github.ref, 'refs/tags/newtonsoft-')
name: Push Newtonsoft package to NuGet
run: ./push.sh newtonsoft nuget ${{ secrets.NUGET_KEY }}
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1