Skip to content

Publish to NuGet + Documentation #178

Publish to NuGet + Documentation

Publish to NuGet + Documentation #178

Workflow file for this run

name: Build, Test, and Deploy Docs
# Trigger
on:
pull_request:
workflow_dispatch:
push:
branches:
- master
permissions:
actions: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
# Checkout the code from the repository
- name: Checkout code
uses: actions/checkout@v3
# Setup .NET environment
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
# Install dependencies
- name: Install dependencies
run: dotnet restore
# Build the project
- name: Build project
run: dotnet build --configuration Release --no-restore -warnaserror
# Run unit tests
- name: Run Unit tests
run: dotnet test --no-build --verbosity normal --configuration Release
publish-docs:
runs-on: ubuntu-latest
needs: build-and-test # Ensures it runs only after build-and-test succeeds
steps:
# Checkout code again because each job starts fresh
- name: Checkout code
uses: actions/checkout@v3
# Install DocFX and Generate Documentation
- name: Generate Documentation with DocFX
uses: dotnet/docfx-action@v1
with:
args: docs/docfx.json
# Deploy the documentation to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site