Towardsnunit4 #964
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: NUnit Documentation Build Process | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
linting: | |
name: "Markdown linting" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Check out the code | |
- uses: actions/setup-node@v3 | |
name: Setup node | |
with: | |
node-version: "18" | |
- run: npm install -g markdownlint-cli2 | |
name: Install markdownlint-cli2 | |
- run: markdownlint-cli2-config ".github/linters/.markdownlint.yml" "docs/**/*.md" | |
name: run Markdownlint | |
spellcheck: | |
name: "Spell check" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Check out the code | |
- uses: actions/setup-node@v3 | |
name: Setup node | |
with: | |
node-version: "18" | |
- run: npm install -g cspell | |
name: Install cSpell | |
- run: cspell --config ./cSpell.json "docs/**/*.md" --no-progress | |
name: run cSpell | |
build: | |
name: "Build the site with docfx" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Check out the code | |
- uses: "nunit/docfx-action@v2.7.0" | |
name: Build with Docfx | |
with: | |
args: docs/docfx.json --warningsAsErrors true | |
- name: zip site contents | |
run: zip -r _site.zip docs/_site/ | |
- name: Archive site artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: siteArtifact | |
path: _site.zip | |
snippets: | |
name: "Build/Test Snippets" | |
runs-on: ubuntu-latest | |
env: | |
SOLUTION_LOCATION: "./docs/snippets/Snippets.sln" | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.x | |
- name: Restore dependencies | |
run: dotnet restore $SOLUTION_LOCATION | |
- name: Build | |
run: dotnet build --no-restore $SOLUTION_LOCATION | |
- name: Test | |
run: dotnet test --no-build --verbosity normal $SOLUTION_LOCATION | |
publish: | |
name: Publish (master branch only) | |
needs: [linting, spellcheck, build] | |
runs-on: ubuntu-latest | |
if: ${{ github.ref == 'refs/heads/master'}} | |
steps: | |
- name: Download site artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: siteArtifact | |
- name: unzip site contents | |
run: unzip _site.zip | |
- name: Push to gh-pages branch (master only) | |
if: ${{ github.ref == 'refs/heads/master'}} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
commit_message: ${{ github.event.head_commit.message }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_site | |
publish_branch: gh-pages |