Fixes and Small Features #18
Workflow file for this run
This file contains hidden or 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/CD Pipeline | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
permissions: | |
contents: read | |
actions: read | |
pages: write | |
id-token: write | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build project | |
run: dotnet build --configuration Release --no-restore -warnaserror | |
- name: Run Unit tests | |
run: dotnet test --no-build --verbosity normal --configuration Release | |
publish-docs: | |
needs: build-and-test | |
if: github.event_name != 'pull_request' | |
concurrency: | |
group: "github-pages" | |
cancel-in-progress: true # Cancels ongoing GitHub Pages deployments if a new one starts | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Dotnet Setup | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.x | |
- run: dotnet tool update -g docfx | |
- run: docfx docs/docfx.json | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'docs/_site' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
publish-nuget: | |
name: Publish to NuGet | |
needs: build-and-test | |
if: github.event_name != 'pull_request' | |
concurrency: | |
group: "nuget-publish" | |
cancel-in-progress: true # Ensures only the latest NuGet package gets published | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build project | |
run: dotnet build --configuration Release | |
- name: Create NuGet package | |
run: dotnet pack --configuration Release --no-build | |
- name: Find and Publish NuGet Package | |
run: dotnet nuget push $(find . -type f -name "*.nupkg") --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |