All checks were successful
Klc-Learner-Frontend-CD / Deploying code in Server (push) Successful in 27s
43 lines
1.1 KiB
YAML
43 lines
1.1 KiB
YAML
name: Enforce Image Standards
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
paths:
|
|
- '**/*.jpg'
|
|
- '**/*.jpeg'
|
|
- '**/*.png'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
optimize:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Debug Event
|
|
run: |
|
|
echo "Base: ${{ gitea.base_ref }}"
|
|
echo "Head: ${{ gitea.head_ref }}"
|
|
|
|
- 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 {} \; |