Skip to content

Fix asset cache busting on GitHub Pages builds#9

Merged
Rochet2 merged 3 commits into
masterfrom
fix-asset-version-deploy
May 27, 2026
Merged

Fix asset cache busting on GitHub Pages builds#9
Rochet2 merged 3 commits into
masterfrom
fix-asset-version-deploy

Conversation

@Rochet2

@Rochet2 Rochet2 commented May 27, 2026

Copy link
Copy Markdown
Owner

Problem

PR #8 generated _data/assets.yml only inside the GitHub Actions runner. GitHub Pages builds the site separately from the repo, and the file was gitignored — so site.data.assets was empty and the layout fell back to ?v=dev.

Fix

  • Commit _data/assets.yml with the current CSS/JS content hash
  • Switch CI to asset_version.py --check (same pattern as WebP derivatives)
  • Fall back to site.github.build_revision before dev if the data file is ever missing

Test plan

  • CI passes
  • After deploy, page source shows ?v=e7eb82e9 (or current hash) on CSS/JS URLs, not dev

Rochet2 and others added 3 commits May 27, 2026 04:44
Commit _data/assets.yml to the repo and validate it in CI, since Pages runs its own Jekyll build and never sees files generated only in Actions.
Add a CI job that regenerates _data/assets.yml and pushes it to the PR branch when CSS or JS changes, so merges already include the correct cache-busting hash.
@Rochet2 Rochet2 merged commit 520b721 into master May 27, 2026
@Rochet2 Rochet2 deleted the fix-asset-version-deploy branch May 27, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant