From 8f474501e00907ae2450cbfc87c2adbe037400b2 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 18 Aug 2026 10:25:35 +1000 Subject: [PATCH] CI: prune the restored _build/html before building MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both ci.yml and publish.yml restore the cached _build and build over it. Sphinx never removes assets deleted from source, so deletions keep being served — in CI previews immediately, on the live site until a clean weekly rebuild happens to intervene. Add jb clean . --html immediately after the cache restore in both workflows. It removes exactly _build/html and nothing else; the .jupyter_cache execution cache is untouched, so the cost is one Sphinx write pass, not a re-execution. Placed before the PDF/notebook steps, which stage their output into _build/html. Ports the prune from QuantEcon/workspace-lectures#41. Co-Authored-By: Claude Fable 5 --- .github/workflows/ci.yml | 9 +++++++++ .github/workflows/publish.yml | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f6c3afe..cb7e84f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,15 @@ jobs: branch: main name: build-cache path: _build + # Prune the restored _build/html so files deleted from source stop being + # published: sphinx copies html_static_path in but never removes stale + # assets. `jb clean . --html` removes exactly _build/html, leaving + # .jupyter_cache (the expensive execution cache), _build/latex and + # _build/jupyter untouched. Must run BEFORE the PDF/notebook steps below, + # which stage output INTO _build/html. + - name: Prune restored HTML (drop stale assets deleted from source) + shell: bash -l {0} + run: jb clean . --html # Build Assets (Download Notebooks and PDF via LaTeX) - name: Build PDF from LaTeX shell: bash -l {0} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f0bf0870..4f1aec3d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -63,6 +63,15 @@ jobs: branch: main name: build-cache path: _build + # Prune the restored _build/html so files deleted from source stop being + # published: sphinx copies html_static_path in but never removes stale + # assets. `jb clean . --html` removes exactly _build/html, leaving + # .jupyter_cache (the expensive execution cache), _build/latex and + # _build/jupyter untouched. Must run BEFORE the PDF/notebook steps below, + # which stage output INTO _build/html. + - name: Prune restored HTML (drop stale assets deleted from source) + shell: bash -l {0} + run: jb clean . --html # Build Assets (Download Notebooks and PDF via LaTeX) - name: Build PDF from LaTeX shell: bash -l {0}