1
0
Fork 0
mirror of https://github.com/walkxcode/dashboard-icons.git synced 2024-11-26 21:25:03 +01:00

👷 Adds SVG & WEBP compression

This commit is contained in:
Bjorn Lammers 2024-10-20 20:29:44 +02:00
parent 5e81ed22f5
commit 6ca707f323
No known key found for this signature in database

View file

@ -1,4 +1,4 @@
name: Compress PNGs 🗜️ name: Compress Icons 🗜️
on: on:
schedule: schedule:
@ -6,7 +6,7 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
compress_pngs: compress_icons:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@ -20,18 +20,29 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y zopfli sudo apt-get install -y zopfli webp
npm install -g svgo
- name: Compress PNG Files - name: Compress PNG Files
run: | run: |
echo "Compressing PNGs..." echo "Compressing PNGs..."
find png/ -iname "*.png" -print0 | xargs -0 -P 4 -I{} zopflipng -y {} {} find png/ -iname "*.png" -print0 | xargs -0 -P 4 -I{} zopflipng -y {} {}
- name: Compress SVG Files
run: |
echo "Compressing SVGs..."
svgo -r -f svg/
- name: Compress WEBP Files
run: |
echo "Compressing WEBPs..."
find webp/ -iname "*.webp" -print0 | xargs -0 -P 4 -I{} bash -c 'cwebp -quiet -q 80 "$1" -o "$1"' _ {}
- name: Commit and Push Changes - name: Commit and Push Changes
run: | run: |
git config --global user.email "noreply@lammers.media" git config --global user.email "noreply@lammers.media"
git config --global user.name "Dashboard Icons Bot" git config --global user.name "Dashboard Icons Bot"
git add png/ git add png/ svg/ webp/
git commit -m ":compression: Compressed PNGs" || exit 0 git commit -m ":compression: Compressed images" || exit 0
git pull --rebase origin ${{ github.ref_name }} git pull --rebase origin ${{ github.ref_name }}
git push origin HEAD:${{ github.ref_name }} git push origin HEAD:${{ github.ref_name }}