Files
KLC-Hr-Dashboard-Frontend/.gitea/workflows/compressimage.yml
Rajendra Reddy 616b795aee
All checks were successful
Klc-HR-Dashboard-Frontend-Build-Check / Build and Test PR (pull_request) Successful in 31s
Klc-Learner-Frontend-Sonar / SonarQube Scan (pull_request) Successful in 56s
Update .gitea/workflows/compressimage.yml
2026-04-13 04:42:40 +00:00

57 lines
1.4 KiB
YAML

name: Enforce Image Standards
on:
pull_request:
branches:
- main
- beta
- testing
- client
- staging
- production
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
#workflow_dispatch:
jobs:
optimize:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Image Tools
run: |
sudo apt-get update
sudo apt-get install -y imagemagick jpegoptim pngquant
- name: Resize Oversized Images
run: |
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) \
-exec mogrify -resize 1920x1920\> {} \;
- name: Optimize JPEG
run: |
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) \
-exec jpegoptim --strip-all --max=85 {} \;
- name: Optimize PNG
run: |
find . -type f -iname "*.png" \
-exec pngquant --force --ext .png --quality=75-90 {} \;
- name: Commit Optimized Images
run: |
git config --global user.name "gitea-actions"
git config --global user.email "actions@local"
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Auto resize and optimize images"
git push origin HEAD:${{ gitea.head_ref }}
else
echo "No changes to commit"
fi