-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (89 loc) · 4.66 KB
/
dotnet-core.yml
File metadata and controls
98 lines (89 loc) · 4.66 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: .NET Core
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
dotnet: [ '3.1.x' ]
name: .NET Core ${{ matrix.dotnet }}
runs-on: ubuntu-latest
env:
DOTNET_NOLOGO: true
outputs:
packageAndVersion: ${{ steps.get_version.outputs.packageAndVersion }}
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v2
# https://github.com/actions/setup-dotnet/
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{matrix.dotnet}}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore --version-suffix ${{ github.run_number }}
- name: Test
run: dotnet test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=opencover
- name: Create the package
run: dotnet pack --configuration Release --version-suffix ${{ github.run_number }} System.Text.Json.Extensions
- name: Get Version
id: get_version
run: |
Write-Host "::set-output name=packageAndVersion::$(Split-Path -Path $(Resolve-Path "System.Text.Json.Extensions/bin/Release/*.nupkg") -LeafBase)"
Write-Host "::set-output name=version::$((Split-Path -Path $(Resolve-Path "System.Text.Json.Extensions/bin/Release/*.nupkg") -LeafBase) -replace '^.*?(\d.*)$','$1')"
shell: pwsh
- uses: actions/upload-artifact@v2
with:
name: Dotnet ${{ matrix.dotnet }}
path: System.Text.Json.Extensions/bin/Release/
if-no-files-found: error
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@4.5.8
with:
reports: '**/TestResults/coverage.opencover.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: 'coveragereport' # REQUIRED # The directory where the generated report should be saved.
reporttypes: 'HtmlInline' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version.
- uses: actions/upload-artifact@v2
with:
name: Dotnet ${{ matrix.dotnet }} coveragereport
path: coveragereport/
if-no-files-found: error
- name: Setup .NET Core for GPR
if: success() && github.repository_owner == 'TheConstructor' && github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.dotnet == '3.1.x'
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{matrix.dotnet}}
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Publish the package to GPR
if: success() && github.repository_owner == 'TheConstructor' && github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.dotnet == '3.1.x'
run: dotnet nuget push System.Text.Json.Extensions/bin/Release/*.nupkg
- name: Create Release
id: create_release
if: success() && github.repository_owner == 'TheConstructor' && github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.dotnet == '3.1.x'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release ${{ steps.get_version.outputs.version }}
draft: true
prerelease: false
- name: Upload Release Asset
if: success() && github.repository_owner == 'TheConstructor' && github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.dotnet == '3.1.x'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: System.Text.Json.Extensions/bin/Release/${{ steps.get_version.outputs.packageAndVersion }}.nupkg
asset_name: ${{ steps.get_version.outputs.packageAndVersion }}.nupkg
asset_content_type: application/zip