Refactor github workflows #22
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
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
tags: | |
- "McPride.Markdig*-v[0-9]+.[0-9]+.[0-9]+" | |
- "McPride.Markdig*-v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+.[0-9]+" | |
- "McPride.Markdig*-v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+.[0-9]+" | |
- "McPride.Markdig*-v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+.[0-9]+" | |
- "McPride.Markdig*-v[0-9]+.[0-9]+.[0-9]+-preview[0-9]+.[0-9]+" | |
- "McPride.Markdig*-v[0-9]+.[0-9]+.[0-9]+-prerelease[0-9]+.[0-9]+" | |
- "McPride.Markdig*-v[0-9]+.[0-9]+.[0-9]+-pre[0-9]+.[0-9]+" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore src/mcpride-markdig-extensions.sln | |
- name: Build Debug | |
run: dotnet build src/mcpride-markdig-extensions.sln --no-restore --configuration Debug | |
- name: Test | |
run: dotnet test src/mcpride-markdig-extensions.sln --no-build --verbosity normal --collect:"XPlat Code Coverage" --logger trx --results-directory ./coverage | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
with: | |
filename: coverage/*/coverage.cobertura.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: false | |
indicators: true | |
output: both | |
thresholds: '60 80' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md | |
- name: Write to Job Summary | |
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY | |
release: | |
if: github.event_name == 'tags' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Restore dependencies | |
run: dotnet restore src/mcpride-markdig-extensions.sln | |
- name: Build release | |
run: dotnet build src/mcpride-markdig-extensions.sln --no-restore --configuration Release | |
- name: Push packages to nuget.org | |
run: dotnet nuget push ./**/Release/McPride.Markdig.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUSH_API_KEY }} |