Skip to content

Cache image derivatives across builds (#140)#143

Merged
Khasir merged 7 commits into
mainfrom
cache-image-derivatives
Jul 4, 2026
Merged

Cache image derivatives across builds (#140)#143
Khasir merged 7 commits into
mainfrom
cache-image-derivatives

Conversation

@alexwolson

Copy link
Copy Markdown
Collaborator

Closes #140.

Adds an actions/cache@v4 step caching _site/assets/thumbs (where jekyll_picture_tag writes derivatives, preserved across builds via Jekyll's keep_files) keyed on archives/images/**, so unchanged-content CI builds regenerate no historical derivatives. The first run populates the cache; later no-image-change runs restore it and skip all generation. Adding/changing an image misses the exact key, restores the most recent cache via restore-keys, regenerates only what changed, and saves a fresh cache.

Why it's safe

JPT only generates a derivative when its output file is absent (generate_image unless @source.missing || exists?), and generated filenames embed an MD5 of the source content ({name}-{width}-{hash}.webp). A changed source therefore produces a new filename and regenerates correctly — no stale-image risk. Only _site/assets/thumbs is cached, never HTML.

Verification (local cold vs. warm build)

Build Images generated Time
Cold (make clean first) 816 ~84s
Warm (derivatives present) 0 18.6s

~4.5× faster with zero regeneration — the same skip behavior CI gains from the restored cache. Will confirm the pattern in post-merge CI logs (first run populates cache; next no-change run shows no Generating new image file: lines).

Out of scope

🤖 Generated with Claude Code

alexwolson and others added 5 commits June 28, 2026 10:38
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The pre-existing sentence said thumbnails cache in assets/thumbs/ and are
gitignored; neither is accurate. JPT writes to _site/assets/thumbs and the
path is not in .gitignore. Aligns with the adjacent caching note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alexwolson
alexwolson requested a review from Khasir June 28, 2026 16:50
@alexwolson
alexwolson removed the request for review from Khasir June 28, 2026 16:51
@alexwolson
alexwolson marked this pull request as draft June 28, 2026 16:51
@github-actions

Copy link
Copy Markdown
Contributor

Pa11y Accessibility Report

All pages passed — 0 warning(s) (WCAG2AA)


Homepage

✅ No issues found.


Event

✅ No issues found.


Project

✅ No issues found.


Person

✅ No issues found.


Organization

✅ No issues found.


Venue

✅ No issues found.


Resource

✅ No issues found.


Tag

✅ No issues found.


Category

✅ No issues found.

@alexwolson
alexwolson marked this pull request as ready for review June 28, 2026 17:02
@alexwolson
alexwolson requested a review from Khasir June 28, 2026 17:02

@Khasir Khasir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alex!

@Khasir
Khasir merged commit 0c65e17 into main Jul 4, 2026
6 checks passed
@Khasir
Khasir deleted the cache-image-derivatives branch July 4, 2026 16:19
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.

Cache image derivatives across builds to cut CI/build time

2 participants