1
0
Fork 0
mirror of https://github.com/walkxcode/dashboard-icons.git synced 2024-11-23 19:59:17 +01:00
dashboard-icons/.github/workflows/compress_icons.yml

49 lines
1.3 KiB
YAML
Raw Normal View History

name: Compress Icons 🗜️
2024-10-20 19:24:03 +02:00
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
compress_icons:
2024-10-20 19:24:03 +02:00
runs-on: ubuntu-latest
2024-10-20 19:37:43 +02:00
permissions:
contents: write
2024-10-20 19:24:03 +02:00
steps:
- name: Checkout Repository
uses: actions/checkout@v3
2024-10-20 19:37:43 +02:00
with:
ref: ${{ github.ref_name }}
2024-10-20 19:24:03 +02:00
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y zopfli webp npm
npm install -g svgo
2024-10-20 19:24:03 +02:00
- name: Compress PNG Files
run: |
echo "Compressing PNGs..."
find png/ -iname "*.png" -print0 | xargs -0 -P 4 -I{} zopflipng -y {} {}
- name: Compress SVG Files
run: |
echo "Compressing SVGs..."
svgo --config=svgo.config.js -f svg/
- name: Compress WEBP Files
run: |
echo "Compressing WEBPs..."
find webp/ -iname "*.webp" -print0 | xargs -0 -P 4 -I{} bash -c 'cwebp -quiet -lossless "$1" -o "$1"' _ {}
2024-10-20 19:24:03 +02:00
- name: Commit and Push Changes
run: |
git config --global user.email "noreply@lammers.media"
git config --global user.name "Dashboard Icons Bot"
git add png/ svg/ webp/
git commit -m ":compression: Compress icons" || exit 0
2024-10-20 19:37:43 +02:00
git pull --rebase origin ${{ github.ref_name }}
git push origin HEAD:${{ github.ref_name }}