-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
51 lines (43 loc) · 1.52 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: "Compress Images"
description: "Compress all images from the provided directory"
author: "Clyde D'Souza"
branding:
icon: "image"
color: "red"
inputs:
input-directory:
description: "Directory that contains uncompressed images"
default: "images"
output-directory:
description: "Directory that will contain the compressed images"
default: "dist"
jpg-compression-quality:
description: "Set the level of compression for JPG image files"
default: 40
png-compression-quality:
description: "Set the level of compression for PNG image files"
default: 0.4
gif-compression-quality:
description: "Set the level of compression for GIF image files"
default: 2
runs:
using: "composite"
steps:
- name: Print npm and node version
shell: bash
run: |
npm --version
node --version
- name: Install required npm packages
shell: bash
run: |
npm install imagemin-cli imagemin-gifsicle imagemin-mozjpeg imagemin-pngquant --global --loglevel error
- name: Run image compression
shell: bash
run: |
imagemin ${{ inputs.input-directory }} \
--out-dir=${{ inputs.output-directory }} \
--plugin.mozjpeg.quality=${{ inputs.jpg-compression-quality }} \
--plugin.gifsicle.optimizationLevel=${{ inputs.gif-compression-quality }} \
--plugin.pngquant.quality=${{ inputs.png-compression-quality }} \
--plugin.pngquant.quality=${{ inputs.png-compression-quality }}