Merge pull request #70 from mhartkorn/fix-versions #59
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: dotnet-main | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
- name: setup | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: retrieve version | |
uses: dotnet/nbgv@master | |
id: nbgv | |
- name: install | |
run: dotnet restore | |
- name: format | |
run: dotnet format --verify-no-changes --no-restore | |
- name: build | |
run: dotnet build -c Release | |
- name: test & cover | |
run: dotnet test --collect "Code Coverage;Format=Xml;CoverageFileName=coverage.xml" --results-directory "./test-results" --no-restore --nologo -c Release --logger trx | |
- name: publish test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: | | |
test-results/**/*.trx | |
- name: publish coverage results | |
uses: im-open/code-coverage-report-generator@4 | |
with: | |
reports: '*/**/coverage.xml' | |
targetdir: './coverage-results' | |
title: dotnet code coverage | |
reporttypes: 'MarkdownSummary;' | |
assemblyfilters: +PiBox* | |
- name: Upload coverage report artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Coverage Report | |
path: coverage-results/** | |
- name: Write to Job Summary | |
run: cat ./coverage-results/Summary.md >> $GITHUB_STEP_SUMMARY | |
- name: Create package | |
run: dotnet pack --no-restore --nologo --no-build -p:PackageOutputPath='./publish' -c Release -p:PackageVersion=${NBGV_NuGetPackageVersion} -p:PublicRelease=true -p:SymbolPackageFormat=snupkg --include-symbols --include-source | |
- name: Publish nuget packages | |
run: dotnet nuget push "**/publish/*.nupkg" -s 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} | |
- name: tag and release | |
uses: ncipollo/release-action@v1 | |
with: | |
commit: main | |
tag: 'v${{ steps.nbgv.outputs.NuGetPackageVersion }}' | |
generateReleaseNotes: true |