diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5939cd8..2efe8a0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -76,13 +76,23 @@ jobs: - name: Synchronize the locked environment run: uv sync --locked - # Build exactly as validation does. BASE_URL makes generated links correct - # if the Pages location ever changes from the root URL. + # This repository is a user site served at the domain root. Do not set + # BASE_URL to "/": MyST adds its own separator, and that value produces + # broken protocol-relative asset paths such as //build/app.js. - name: Build the production website - env: - BASE_URL: ${{ steps.pages.outputs.base_path || '/' }} run: uv run --locked jupyter book build --html --strict + # A successful renderer exit is not enough if its asset URLs are invalid. + # Reject the exact regression observed during the first deployment. + - name: Check generated asset paths + shell: bash + run: | + test -f _build/html/index.html + if grep -RIlE '(src|href)="//build/' _build/html; then + echo "::error::Generated HTML contains broken //build/ asset URLs." + exit 1 + fi + # This special Pages artifact is temporary deployment input. It is not # committed to gh-pages and contains only the generated static website. - name: Package the generated website for Pages diff --git a/PLAN.md b/PLAN.md index 2cdd3d4..bd03f82 100644 --- a/PLAN.md +++ b/PLAN.md @@ -100,10 +100,11 @@ permissions to the validation workflow. - Remove the legacy configuration backups only after the production site has been stable and the rollback procedure is documented. -**Progress:** the manually triggered workflow is prepared on the -`pages-deployment` branch. It must pass pull-request validation, be merged, -and then be enabled and exercised deliberately through the GitHub Pages -settings and Actions interface. +**Progress:** the manual workflow was merged and its first run completed, but +visual review caught malformed `//build/` asset URLs caused by setting the +root `BASE_URL` to `/`. The `fix-pages-base-url` branch removes that +override and adds a regression check. A corrected deployment and visual +verification remain required. **Milestone exit criterion:** the Jupyter Book 2 site is live, important routes are verified, deployment is reproducible, and a failed build cannot replace the diff --git a/README.md b/README.md index 659a5c6..0dcea58 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ Run the non-interactive validation check before committing: The script synchronizes the locked environment, removes any previous `_build` output, and performs a clean Jupyter Book 2 build with strict validation. It -deletes the generated site when the check finishes, including after a failure. +also rejects invalid root asset URLs and deletes the generated site when the +check finishes, including after a failure. ## Build and preview locally diff --git a/scripts/check.ps1 b/scripts/check.ps1 index 9de9500..13da3cb 100644 --- a/scripts/check.ps1 +++ b/scripts/check.ps1 @@ -77,6 +77,16 @@ try { throw "The build completed without creating $indexPath" } + $invalidAssetMatch = Get-ChildItem -LiteralPath (Join-Path $buildPath 'html') -Recurse -File -Filter '*.html' | + ForEach-Object { + Select-String -LiteralPath $_.FullName -Pattern '(?:src|href)="//build/' | + Select-Object -First 1 + } | + Select-Object -First 1 + if ($null -ne $invalidAssetMatch) { + throw "Generated HTML contains a broken //build/ asset URL" + } + Write-Host 'Validation passed: the strict build completed successfully.' } finally {