Skip to content

Documentation

Documentation #5

Workflow file for this run

name: Documentation
on:
workflow_run:
workflows: ['CI']
types:
- completed
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
actions: read
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build-docs:
name: Build documentation
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
- name: Get module name
id: module
shell: pwsh
run: |
$manifest = Get-ChildItem -Path src -Filter '*.psd1' -Recurse | Select-Object -First 1
$moduleName = [System.IO.Path]::GetFileNameWithoutExtension($manifest.Name)
echo "name=$moduleName" >> $env:GITHUB_OUTPUT
- name: Download module artifact from CI
if: ${{ github.event_name == 'workflow_run' }}
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with:
name: ${{ steps.module.outputs.name }}-Module
path: Artifacts/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Build module (if artifact not available)
shell: pwsh
run: |
$moduleName = '${{ steps.module.outputs.name }}'
$manifestPath = "Artifacts/$moduleName.psd1"
if (-not [System.IO.File]::Exists($manifestPath)) {
Write-Host 'Module artifact not found, building from source...'
./build.ps1 -Build
} else {
Write-Host 'Using module artifact from CI'
}
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
- name: Cache PowerShell modules
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: ~/.local/share/powershell/Modules
key: ${{ runner.os }}-psmodules-${{ hashFiles('install_modules.ps1') }}
- name: Install PowerShell modules
shell: pwsh
run: ./install_modules.ps1
- name: Check documentation infrastructure
id: check_docs
shell: pwsh
run: |
$hasRequirements = [System.IO.File]::Exists('docs/requirements.txt')
$hasMkdocs = [System.IO.File]::Exists('mkdocs.yml')
$hasDocGen = [System.IO.File]::Exists('.build/Invoke-DocumentationGeneration.ps1')
$ready = $hasRequirements -and $hasMkdocs -and $hasDocGen
echo "ready=$($ready.ToString().ToLower())" >> $env:GITHUB_OUTPUT
if (-not $ready) {
Write-Host '::warning::Documentation infrastructure incomplete'
Write-Host " requirements.txt: $hasRequirements"
Write-Host " mkdocs.yml: $hasMkdocs"
Write-Host " Invoke-DocumentationGeneration.ps1: $hasDocGen"
}
- name: Generate function documentation
if: steps.check_docs.outputs.ready == 'true'
shell: pwsh
run: ./.build/Invoke-DocumentationGeneration.ps1 -ModuleName ${{ steps.module.outputs.name }} -Force
- name: Setup Python
if: steps.check_docs.outputs.ready == 'true'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.11'
cache: 'pip'
- name: Install MkDocs dependencies
if: steps.check_docs.outputs.ready == 'true'
run: pip install -r docs/requirements.txt
- name: Build MkDocs site
if: steps.check_docs.outputs.ready == 'true'
run: mkdocs build --strict
- name: Upload artifact
if: steps.check_docs.outputs.ready == 'true'
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
with:
path: site/
deploy-docs:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build-docs
if: success()
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e