2
0

make-docs.ps1 853 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env pwsh
  2. <#
  3. .SYNOPSIS
  4. Builds the documentation as HTML.
  5. #>
  6. # Get path.
  7. $scriptDir = Split-Path $PSCommandPath -Parent
  8. $projectDir = (Get-Item $scriptDir).Parent
  9. $docsDir = Join-Path -Path $projectDir -ChildPath "docs"
  10. $docsBuildDir = Join-Path -Path $docsDir -ChildPath "_build"
  11. $ExitCode = 0
  12. # Clean previously built docs.
  13. sphinx-build -M clean $docsDir $docsBuildDir
  14. # Make docs, treat warnigs as errors.
  15. sphinx-build -M html $docsDir $docsBuildDir -W
  16. $ExitCode = $LastExitCode
  17. # Write output for humans.
  18. if ($ExitCode -eq 0) {
  19. Write-Host "Docs have been built! 📜" -ForegroundColor Green
  20. }
  21. else {
  22. # Write the error in a way that shows up as the failure reason in Azure Pipelines.
  23. Write-Host "##vso[task.LogIssue type=error;]There were warnings or errors building the docs."
  24. }
  25. # Exit with sphinx's code.
  26. exit $ExitCode