Add build-time image optimization (pngquant/oxipng/jpegoptim) to pipeline
Lint, build, test and deploy / lint (push) Successful in 59s
Lint, build, test and deploy / build (push) Failing after 1m32s
Lint, build, test and deploy / test (push) Skipped
Lint, build, test and deploy / deploy (push) Skipped

This commit is contained in:
Leon Xu committed 2026-11-29 14:46:04 -08:00
1 parent 3f5ba20810
commit 663c0aab25
2 files changed
+12 -2

No files matched your search

+9
View File
@@ -48,6 +48,15 @@ jobs:
- name: Build site
run: hexo generate
# Best-effort image optimization at build time: originals in source/
# stay untouched, only the built artifact shrinks (~58% on this site).
- name: Optimize images
run: |
apt-get update -qq && apt-get install -y -qq pngquant oxipng jpegoptim
find public -type f -name '*.png' -exec sh -c 'pngquant --quality=80-95 --strip --force --skip-if-larger --output "$1" "$1"; oxipng -o max -q "$1"' _ {} \;
find public -type f \( -name '*.jpg' -o -name '*.jpeg' \) -exec jpegoptim --max=90 --strip-all --threshold=5 -q {} \;
echo "site size after optimization: $(du -sh public | cut -f1)"
- name: Upload site artifact
uses: actions/upload-artifact@v4
with: