Skip to content

chore(deps): bump NUnit in /WikiPageStatsGenerator.Test #75

chore(deps): bump NUnit in /WikiPageStatsGenerator.Test

chore(deps): bump NUnit in /WikiPageStatsGenerator.Test #75

name: Build, Release, Publish
on:
push:
pull_request:
branches: [ "main" ]
jobs:
unit-test:
runs-on: ${{ matrix.os }}
needs: []
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- uses: actions/checkout@v4
with:
path: app
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
- name: Build with dotnet
run: dotnet build --configuration Release
working-directory: app
- name: Generate coverage report
run: dotnet test --collect:"XPlat Code Coverage" --results-directory "test-results"
working-directory: app
- name: Move coverage report from GUID folder to test-results
run: find test-results -name "coverage.cobertura.xml" -exec mv {} test-results \;
shell: bash
working-directory: app
if: ${{ always() }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: app/test-results/coverage.cobertura.xml
fail_ci_if_error: true
if: ${{ always() && matrix.os == 'ubuntu-latest' }}
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
name: testresults-unit
path: app/test-results
if: ${{ always() }}
- name: Upload binaries as ${platform}-artifact
uses: actions/upload-artifact@v3
with:
name: binaries-${{ matrix.os }}
path: app/WikiPageStatsGenerator/bin/Release/net7.0/*
if: ${{ always() }}
release:
runs-on: ubuntu-latest
needs: [ unit-test ]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && secrets.ELEVATED_GITHUB_TOKEN || github.token }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: Setup git
run: |
git config --local user.email "versionize-bot@by.vincent.mahn.ke"
git config --local user.name "Versionize Bot"
- name: Install Versionize
run: dotnet tool install --global Versionize
- name: Run Versionize
id: versionize
run: 'versionize --changelog-all --exit-insignificant-commits --commit-suffix " [skip ci]"'
continue-on-error: true
- name: No release required
if: steps.versionize.outcome != 'success'
run: echo "Skipping Release. No release required."
- name: Push changes to GitHub
if: steps.versionize.outcome == 'success'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
- name: Create NuPkg
if: steps.versionize.outcome == 'success'
run: dotnet pack --configuration Release
- name: Download ubuntu artifacts
if: steps.versionize.outcome == 'success'
uses: actions/download-artifact@v3
with:
name: binaries-ubuntu-latest
path: ubuntu-artifacts
- name: Download windows artifacts
if: steps.versionize.outcome == 'success'
uses: actions/download-artifact@v3
with:
name: binaries-windows-latest
path: windows-artifacts
- name: Download macos artifacts
if: steps.versionize.outcome == 'success'
uses: actions/download-artifact@v3
with:
name: binaries-macos-latest
path: macos-artifacts
- run: |
version=$(git describe --tags --abbrev=0)
zip -r WikiPageStatsGenerator-ubuntu-x64-$version.zip ubuntu-artifacts
zip -r WikiPageStatsGenerator-windows-x64-$version.zip windows-artifacts
zip -r WikiPageStatsGenerator-macos-x64-$version.zip macos-artifacts
zip -r WikiPageStatsGenerator-nupkg-x64-$version.zip WikiPageStatsGenerator/nupkg/*.nupkg -j
if: steps.versionize.outcome == 'success'
- name: "Create release with all artifacts"
if: steps.versionize.outcome == 'success'
run: |
version=$(git describe --tags --abbrev=0)
gh release create $version \
-t "$version" \
-R ${{ github.repository }} \
--target ${{ github.sha }} \
--title "$version" \
-F CHANGELOG.md \
WikiPageStatsGenerator-nupkg-x64-$version.zip \
WikiPageStatsGenerator-ubuntu-x64-$version.zip \
WikiPageStatsGenerator-windows-x64-$version.zip \
WikiPageStatsGenerator-macos-x64-$version.zip
env:
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
shell: bash
- name: Publish to NuGet
if: steps.versionize.outcome == 'success'
run: |
version=$(git describe --tags --abbrev=0)
dotnet nuget push WikiPageStatsGenerator/nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
env:
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
shell: bash