Skip to content

Commit 75912ac

Browse files
Constrain Zensical site_dir to project root
Set zensical site_dir to _site in generated config, move built output to ../../_site for artifact upload, and keep Build-Site output contract intact. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent a088cea commit 75912ac

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/Build-Site.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,12 @@ jobs:
138138
$docsConfigContent = Get-Content -Path $docsConfigSourcePath -Raw
139139
$docsConfigContent = $docsConfigContent.Replace('-{{ REPO_NAME }}-', $ModuleName)
140140
$docsConfigContent = $docsConfigContent.Replace('-{{ REPO_OWNER }}-', $env:GITHUB_REPOSITORY_OWNER)
141-
if ($docsConfigFileName -eq 'zensical.toml' -and $docsConfigContent -notmatch '(?m)^\s*site_dir\s*=') {
142-
$docsConfigContent = $docsConfigContent -replace '(?m)^\[project\]\s*$', "[project]`nsite_dir = ""../../_site"""
141+
if ($docsConfigFileName -eq 'zensical.toml') {
142+
if ($docsConfigContent -match '(?m)^\s*site_dir\s*=') {
143+
$docsConfigContent = $docsConfigContent -replace '(?m)^\s*site_dir\s*=.*$', 'site_dir = "_site"'
144+
} else {
145+
$docsConfigContent = $docsConfigContent -replace '(?m)^\[project\]\s*$', "[project]`nsite_dir = ""_site"""
146+
}
143147
}
144148
$docsConfigContent | Set-Content -Path $docsConfigTargetPath -Force
145149
@@ -166,6 +170,12 @@ jobs:
166170
}
167171
168172
LogGroup 'Build docs - verify output' {
173+
if (Test-Path -Path '_site') {
174+
if (Test-Path -Path '../../_site') {
175+
Remove-Item -Path '../../_site' -Recurse -Force
176+
}
177+
Move-Item -Path '_site' -Destination '../../_site' -Force
178+
}
169179
if (-not (Test-Path -Path '../../_site')) {
170180
throw "Expected Zensical output at ../../_site but it was not created."
171181
}

0 commit comments

Comments
 (0)