v0.4.0 • Add support for configuration via options #17
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
name: Release | |
run-name: ${{ github.ref_name }} • ${{ github.event.head_commit.message }} | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
permissions: | |
contents: read | |
actions: read | |
checks: write | |
packages: write | |
jobs: | |
Build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛒 Checkout repository | |
uses: actions/checkout@v4 | |
- name: 🛟 Verify commit exists in origin/main | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
git branch --remote --contains | grep origin/main | |
- name: 🏷️ Set VERSION variable from tag | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: ⚙️ Setup dotnet 8.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: 🧹 Clean | |
run: dotnet clean -c Release && dotnet nuget locals all --clear | |
- name: 🏗️ Restore dependencies | |
run: dotnet restore | |
- name: 🛠️ Build solution | |
run: dotnet build --no-restore -c:Release -p:SourceRevisionId=${VERSION} -p:Version=${VERSION} | |
- name: 🧪 Run tests | |
run: dotnet test --no-build -c:Release --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage" || true | |
- name: 📋 Test Report | |
uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: Test Report | |
path: "**/test-results.trx" | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: 📋 Test Report | |
uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: Test Report | |
path: "**/test-results.trx" | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: 📭 Restore coverage history | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
name: CoverageHistory | |
path: CoverageHistory | |
continue-on-error: true | |
- name: 📝 Generate Coverage report | |
uses: danielpalme/ReportGenerator-GitHub-Action@5.2.0 | |
with: | |
reports: "**/coverage.cobertura.xml" | |
targetdir: CoverageReports | |
historydir: CoverageHistory | |
reporttypes: MarkdownSummaryGithub;MarkdownDeltaSummary;HtmlInline | |
filefilters: -*.g.cs | |
tag: '${{ github.run_number }}_${{ github.run_id }}' | |
- name: 📨 Post code coverage results | |
run: | | |
cat CoverageReports/SummaryGithub.md >> $GITHUB_STEP_SUMMARY | |
- name: 📬 Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CoverageReports | |
path: CoverageReports | |
- name: 📬 Upload coverage history | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CoverageHistory | |
path: CoverageHistory | |
- name: 📦 Push packages to NuGet | |
run: dotnet nuget push **/Cabazure.*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_KEY }} --skip-duplicate --no-symbols |