-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (69 loc) · 2.08 KB
/
ci.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
76
name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- 'main'
- 'release-*'
jobs:
build:
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 1
DOTNET_NOLOGO: 1
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch full history for NBGV
- name: Set up dotnet
uses: actions/setup-dotnet@v4
- name: Run dotnet restore
run: >
dotnet restore --locked-mode
-bl:"reports/dotnet-restore.binlog"
- name: Run dotnet build
run: >
dotnet build --no-restore
-bl:"reports/dotnet-build.binlog"
-c Release
- name: Run dotnet test
run: >
dotnet test --no-build
-bl:"reports/dotnet-test.binlog"
-c Release
--results-directory "reports"
--collect "XPlat Code Coverage"
--logger "GitHubActions"
--logger "trx;LogFilePrefix=${{ github.job }}"
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run dotnet pack
run: >
dotnet pack --no-build
-bl:"reports/dotnet-pack.binlog"
-c Release
-o ${{ runner.temp }}
- name: Push packages to GitHub Packages
run: >
dotnet nuget push ${{ runner.temp }}/*.nupkg
-k "${{ github.token }}"
-s "$NUGET_SOURCE"
--skip-duplicate
# publish release builds to nuget.org!
- name: Push packages to NuGet.org
if: startsWith(github.ref, 'refs/heads/release-')
run: >
dotnet nuget push ${{ runner.temp }}/*.nupkg
-k "${{ secrets.NUGET_API_KEY }}"
-s "https://api.nuget.org/v3/index.json"
--skip-duplicate
- name: Upload workflow artifact 'reports'
if: always()
uses: actions/upload-artifact@v4
with:
name: reports
path: reports/*