File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Build-ZensicalSite
2+
3+ Builds Zensical documentation site output and normalizes it to ` <working-directory>/_site ` .
4+
5+ ## Inputs
6+
7+ - ` WorkingDirectory ` (required): Build working directory.
8+
9+ ## Usage
10+
11+ ``` yaml
12+ - name : Build documentation site with Zensical
13+ uses : ./_wf/.github/actions/Build-ZensicalSite
14+ with :
15+ WorkingDirectory : .
16+ ` ` `
Original file line number Diff line number Diff line change 1111 steps :
1212 - name : Build documentation site
1313 shell : pwsh
14- run : ' & "${{ github.action_path }}/src/build-zensical-site .ps1" -WorkingDirectory "${{ inputs.WorkingDirectory }}"'
14+ run : ' & "${{ github.action_path }}/src/main .ps1" -WorkingDirectory "${{ inputs.WorkingDirectory }}"'
Original file line number Diff line number Diff line change 1+ # Requires -Version 7.0
2+
3+ [CmdletBinding ()]
4+ param (
5+ [Parameter (Mandatory )]
6+ [string ]$WorkingDirectory
7+ )
8+
9+ $ErrorActionPreference = ' Stop'
10+
11+ $resolvedWorkingDirectory = Resolve-Path - Path $WorkingDirectory | Select-Object - ExpandProperty Path
12+ $siteWorkingDirectory = Join-Path - Path $resolvedWorkingDirectory - ChildPath ' outputs/site'
13+ $outputSitePath = Join-Path - Path $resolvedWorkingDirectory - ChildPath ' _site'
14+
15+ Set-Location - Path $siteWorkingDirectory
16+
17+ if (-not (Test-Path - Path ' zensical.toml' )) {
18+ throw " No documentation config file found in outputs/site. Expected zensical.toml."
19+ }
20+
21+ zensical build -- config- file ' zensical.toml'
22+
23+ if (Test-Path - Path ' _site' ) {
24+ if (Test-Path - Path $outputSitePath ) {
25+ Remove-Item - Path $outputSitePath - Recurse - Force
26+ }
27+ Move-Item - Path ' _site' - Destination $outputSitePath - Force
28+ }
29+
30+ if (-not (Test-Path - Path $outputSitePath )) {
31+ throw " Expected Zensical output at $outputSitePath but it was not created."
32+ }
Original file line number Diff line number Diff line change 1+ # Inject-SiteScripts
2+
3+ Injects JavaScript snippets from ` .github/scripts/site-injectors/*.js ` into generated HTML files.
4+
5+ ## Inputs
6+
7+ - ` SitePath ` (required): Path to generated site output.
8+ - ` WorkflowPath ` (optional, default ` _wf ` ): Path where workflow repository is checked out.
9+
10+ ## Usage
11+
12+ ``` yaml
13+ - name : Inject shared site scripts
14+ uses : ./_wf/.github/actions/Inject-SiteScripts
15+ with :
16+ SitePath : ./_site
17+ WorkflowPath : _wf
18+ ` ` `
Original file line number Diff line number Diff line change 1515 steps :
1616 - name : Inject site scripts
1717 shell : pwsh
18- run : ' & "${{ github.action_path }}/src/inject-site-scripts .ps1" -SitePath "${{ inputs.SitePath }}" -WorkflowPath "${{ inputs.WorkflowPath }}"'
18+ run : ' & "${{ github.action_path }}/src/main .ps1" -SitePath "${{ inputs.SitePath }}" -WorkflowPath "${{ inputs.WorkflowPath }}"'
Original file line number Diff line number Diff line change 1+ # Requires -Version 7.0
2+
3+ [CmdletBinding ()]
4+ param (
5+ [Parameter (Mandatory )]
6+ [string ]$SitePath ,
7+
8+ [Parameter (Mandatory )]
9+ [string ]$WorkflowPath
10+ )
11+
12+ $resolvedSitePath = Resolve-Path - Path $SitePath - ErrorAction Stop | Select-Object - ExpandProperty Path
13+ $injectorsPath = Join-Path - Path $env: GITHUB_WORKSPACE - ChildPath " $WorkflowPath /.github/scripts/site-injectors"
14+
15+ if (-not (Test-Path - Path $injectorsPath )) {
16+ throw " Expected site injector folder at $injectorsPath but it was not found."
17+ }
18+
19+ $injectorScripts = Get-ChildItem - Path $injectorsPath - File - Filter ' *.js' | Sort-Object - Property Name
20+ if (-not $injectorScripts ) {
21+ Write-Host " No site injector scripts found under $injectorsPath ."
22+ exit 0
23+ }
24+
25+ Get-ChildItem - Path $resolvedSitePath - Filter ' *.html' - Recurse | ForEach-Object {
26+ $html = Get-Content - Path $_.FullName - Raw
27+ $modified = $false
28+
29+ foreach ($injectorScript in $injectorScripts ) {
30+ $marker = " data-psmodule-site-injector="" $ ( $injectorScript.Name ) "" "
31+ if ($html -match [Regex ]::Escape($marker )) {
32+ continue
33+ }
34+
35+ $scriptContent = Get-Content - Path $injectorScript.FullName - Raw
36+ $injectedScript = " <script $marker >$scriptContent </script>"
37+ $html = $html -replace ' </body>' , " $injectedScript `n </body>"
38+ $modified = $true
39+ }
40+
41+ if ($modified ) {
42+ Set-Content - Path $_.FullName - Value $html - NoNewline
43+ }
44+ }
Original file line number Diff line number Diff line change 1+ # Install-Zensical
2+
3+ Installs the Zensical CLI used by site build workflows.
4+
5+ ## Inputs
6+
7+ None.
8+
9+ ## Usage
10+
11+ ``` yaml
12+ - name : Install Zensical
13+ uses : ./_wf/.github/actions/Install-Zensical
14+ ` ` `
Original file line number Diff line number Diff line change 66 steps :
77 - name : Install Zensical CLI
88 shell : pwsh
9- run : ' & "${{ github.action_path }}/src/install-zensical .ps1"'
9+ run : ' & "${{ github.action_path }}/src/main .ps1"'
Original file line number Diff line number Diff line change 1+ # Requires -Version 7.0
2+
3+ [CmdletBinding ()]
4+ param ()
5+
6+ $ErrorActionPreference = ' Stop'
7+
8+ pip install zensical
Original file line number Diff line number Diff line change 1+ # Structure-Site
2+
3+ Prepares site content and writes a resolved Zensical config file under ` outputs/site ` .
4+
5+ ## Inputs
6+
7+ - ` WorkingDirectory ` (required): Build working directory.
8+ - ` Name ` (optional): Module name override.
9+
10+ ## Usage
11+
12+ ``` yaml
13+ - name : Structure site
14+ uses : ./_wf/.github/actions/Structure-Site
15+ with :
16+ WorkingDirectory : .
17+ Name : MyModule
18+ ` ` `
You can’t perform that action at this time.
0 commit comments