Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v6
Expand All @@ -34,7 +36,35 @@ jobs:
- name: Generate Coverage Report
run: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:./coverage/coverage.cobertura.xml -targetdir:./coverage/report -reporttypes:"MarkdownSummaryGithub" -assemblyfilters:"+SimpleBranchVersioning"
reportgenerator -reports:./coverage/coverage.cobertura.xml -targetdir:./coverage/report -reporttypes:"MarkdownSummaryGithub;Badges" -assemblyfilters:"+SimpleBranchVersioning"

- name: Add Coverage to Job Summary
run: cat ./coverage/report/SummaryGithub.md >> $GITHUB_STEP_SUMMARY

- name: Publish Coverage Badge
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

mkdir -p /tmp/badges
cp ./coverage/report/badge_linecoverage.svg /tmp/badges/
cp ./coverage/report/badge_branchcoverage.svg /tmp/badges/

if git ls-remote --exit-code --heads origin coverage; then
git fetch origin coverage
git checkout coverage
else
git checkout --orphan coverage
git rm -rf .
fi

cp /tmp/badges/*.svg .
git add badge_linecoverage.svg badge_branchcoverage.svg

if git diff --staged --quiet; then
echo "No changes to coverage badges"
else
git commit -m "Update coverage badges"
git push origin coverage
fi
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SimpleBranchVersioning

[![Build](https://github.com/stephanprobst/SimpleBranchVersioning/actions/workflows/build.yml/badge.svg)](https://github.com/stephanprobst/SimpleBranchVersioning/actions/workflows/build.yml)
[![Coverage](https://raw.githubusercontent.com/stephanprobst/SimpleBranchVersioning/coverage/badge_linecoverage.svg)](https://github.com/stephanprobst/SimpleBranchVersioning/actions/workflows/build.yml)
[![NuGet](https://img.shields.io/nuget/v/SimpleBranchVersioning.svg)](https://www.nuget.org/packages/SimpleBranchVersioning)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Expand Down