chore: update image cache (2024-10-20--22-53-17) #17
This file contains 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: Convert images to webp | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
jpg2webp: | |
runs-on: ubuntu-latest | |
name: convert to webp | |
steps: | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: download & install libwebp | |
run: | | |
wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.4.0-linux-x86-64.tar.gz | |
tar -xzf libwebp-1.4.0-linux-x86-64.tar.gz | |
sudo cp libwebp-1.4.0-linux-x86-64/bin/* /usr/local/bin/ | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: convert | |
run: find . -type f -name "*.jpg" -exec sh -c 'cwebp -q 80 "$1" -o "${1%.jpg}.webp" && rm "$1"' _ {} \; | |
- name: update index.json | |
run: python index.py | |
- name: push changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '3github-actions[bot]@users.noreply.github.com' | |
git add *.webp | |
git add index.json | |
git commit -m "chore: jpg2webp - $(date)" | |
git push |