docs icon indicating copy to clipboard operation
docs copied to clipboard

Cache resources/_gen in CI to skip repeated WebP encoding

Open hiyach28 opened this issue 1 month ago • 1 comments

Follow-up from #1257 / #1259.

Since #1259, a cold build encodes WebP derivatives for every content PNG/JPEG, which took a full build from 14.7s to 72.9s. With resources/_gen present a build takes about 16s.

Neither .github/workflows/hugo.yaml nor .github/workflows/build-docs-preview.yml caches resources/_gen, so every deploy and every preview build pays the ~58s encode.

Proposal

Add an actions/cache step for resources/_gen in both workflows, keyed on the image sources and the image-processing settings (hugo.toml [imaging], render-image.html) so a quality change invalidates it.

Done when

A second CI run with no image changes restores the cache and builds in roughly the warm-build time.

hiyach28 avatar Oct 14 '26 13:10 hiyach28

Hi, I'd like to work on this. Could a maintainer assign it to me?

My plan is what the issue describes. I'll add an actions/cache step for resources/_gen to both hugo.yaml and build-docs-preview.yml. The key will cover the content images, hugo.toml and render-image.html, so a change to any of them saves a fresh cache. In the preview workflow I'll pin the action by SHA like the other steps there. The PR will show build times from a cold run and from a second run that restores the cache.

VanshajPoonia avatar Nov 10 '26 06:11 VanshajPoonia