Bump Microsoft.NET.Test.Sdk from 17.10.0 to 17.12.0 #92
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aspects of this code have been sourced from: https://github.com/moq/Moq.AutoMocker/blob/master/.github/workflows/dotnetcore.yml | |
name: Continuous Build Workflow | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
tags: | |
- 'v*' | |
paths-ignore: | |
- 'README.md' | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
- name: Install Required .NET Tools | |
run: | | |
dotnet new tool-manifest | |
dotnet tool install dotnet-reportgenerator-globaltool | |
dotnet tool install dotnet-coverage | |
- name: .NET Build | |
run: dotnet build --configuration "Release" | |
- name: .NET Test and Collect Coverage | |
run: dotnet test --configuration "Release" --collect:"XPlat Code Coverage" --results-directory ./coverage | |
- name: .NET Pack | |
run: | | |
if ('${{ github.ref }}' -match '^refs/tags/v') { | |
$match = [regex]::Match('${{ github.ref }}', '^refs/tags/v([0-9]+(\.[0-9]+){1,2})') | |
if ($match.Success) { | |
$env:VersionPrefix = $match.Groups[1].Value | |
} else { | |
throw 'Invalid tag version: ${{ github.ref }}' | |
} | |
} | |
else { | |
<# All other pushes get a "beta" suffix #> | |
$env:VersionSuffix = 'beta-{0:0000}' -f ${{ github.run_number }} | |
} | |
dotnet pack --configuration Release --output . | |
- name: Generate Report | |
run: | | |
dotnet reportgenerator -reports:"**/coverage/**/coverage.cobertura.xml" -targetdir:"./coverage/coveragereport" -reporttypes:"MarkdownSummaryGithub;Html" | |
- name: Upload Code Coverage Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coveragereport | |
path: ./coverage/coveragereport | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
header: 'Coverage-Report' | |
message: | | |
Package Coverage Report | |
path: ./coverage/coveragereport/SummaryGithub.md | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: NuGet | |
if-no-files-found: error | |
path: | | |
**/*.nupkg | |
**/*.snupkg | |
- name: Publish NuGet and GitHub | |
if: github.event_name == 'push' | |
run: | | |
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }} --skip-duplicate | |
dotnet nuget push *.nupkg ` | |
--source 'https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json' ` | |
--api-key '${{ secrets.GITHUB_TOKEN }}' ` | |
--skip-duplicate |