Add post: 2026-03-04-charlax-professional-programming.md #10202
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Image Compression (Lossless) | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'docs/assets/**' | ||
| workflow_dispatch: | ||
| jobs: | ||
| compress: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Start timer | ||
| run: echo "START=$EPOCHSECONDS" >> $GITHUB_ENV | ||
| - uses: actions/checkout@v4 | ||
| - name: Install tools | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y oxipng jpegoptim | ||
| - name: Optimize PNGs (lossless) | ||
| run: | | ||
| set -e | ||
| find docs/assets -type f -iname '*.png' -print0 | xargs -0 -n50 oxipng -o 4 --strip all || true | ||
| - name: Optimize JPEGs (lossless) | ||
| run: | | ||
| set -e | ||
| find docs/assets -type f \( -iname '*.jpg' -o -iname '*.jpeg' \) -print0 | xargs -0 -n50 jpegoptim --strip-all --all-progressive || true | ||
| - name: Commit optimized images | ||
| uses: stefanzweifel/git-auto-commit-action@v5 | ||
| with: | ||
| commit_message: "ci: compress images (pngquant/oxipng/jpegoptim)" | ||
| - name: Job runtime | ||
| if: always() | ||
| run: echo "Job runtime: $(( (EPOCHSECONDS-START+59)/60 )) min" >> $GITHUB_STEP_SUMMARY | ||