Skip to content

Merge pull request #921 from ojopiyo/patch-16 #831

Merge pull request #921 from ojopiyo/patch-16

Merge pull request #921 from ojopiyo/patch-16 #831

name: Generate Site
on:
push:
branches:
# Only update docs for main branch pushes
- main
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
docfx:
permissions:
contents: write
# The type of runner that the job will run on
# Note temporary patch - https://github.com/actions/runner-images/issues/10636
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# prevent parallel executions
- name: Wait for actions to finish
uses: softprops/turnstyle@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Checks-out main branch
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
path: main
# Checks-out gh-pages branch
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
# Install .NET SDK (if not already available) and DocFx as a dotnet tool
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- name: Install DocFx
run: |
cd main
dotnet tool restore
# Build docs
- name: Build docs
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
Set-StrictMode -Version 2.0
cd main
# Data Generated Content
./docfx/report-matrix.ps1 -BaseDir "." -ReportFile "./docfx/matrix.md"
./docfx/report-metadata.ps1 -BaseDir "." -ReportFile "./docfx/metadata.md"
./docfx/report-cmdusage.ps1 -BaseDir "." -ReportFile "./docfx/cmdusage.md"
./docfx/report-age.ps1 -BaseDir "." -ReportFile "./docfx/age.md"
./docfx/generate-samplesJson.ps1 -BaseDir "." -OutputFile "./docfx/samples.json"
# Main DocFX build
dotnet docfx build ./docfx/docfx.json --warningsAsErrors $args
# Copy the created site to the gh-pages folder
copy-item -Force -Recurse ./docfx/_site/* -Destination "../gh-pages"
# Add, commit and push the changes
- name: Add & Commit & Push
uses: EndBug/add-and-commit@v6
with:
# The directory where your repository is located. You should use actions/checkout first to set it up
cwd: ./gh-pages
branch: gh-pages
push: true
token: ${{ secrets.GITHUB_TOKEN }}