This commit is contained in:
Struchkov Mark 2024-09-03 15:40:16 +03:00
parent 3f018a1153
commit cba2a62d6e
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C
5 changed files with 39 additions and 2 deletions

View File

@ -22,7 +22,8 @@ steps:
- cd /usr/src/app/ - cd /usr/src/app/
- npx quartz build - npx quartz build
- chmod +x zip_image.sh - chmod +x zip_image.sh
- sh zip_image.sh ./public - mv zip_image.sh ./public/meta/files
- sh ./public/meta/files/zip_image.sh ./public
- mv /usr/src/app/public /drone/src - mv /usr/src/app/public /drone/src
- name: publish to server - name: publish to server
image: private.docker.struchkov.dev/mkdocs:latest image: private.docker.struchkov.dev/mkdocs:latest
@ -52,6 +53,6 @@ steps:
# drone sign --save upagge/digital-garden # drone sign --save upagge/digital-garden
--- ---
kind: signature kind: signature
hmac: 3512ff98808c57eca116f0cc3bf76fbb544f3fc86cf74b03ad447e3d1fb6136c hmac: 3763b24477cb80f00096f33a7c732397bb7e83c4756811b03ae1349d4bbd9f7f
... ...

1
meta/files/comp.flag Normal file
View File

@ -0,0 +1 @@
вторник, 3 сентября 2024 г. 14:56:39 (MSK)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

35
meta/files/zip_image.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
file=comp.flag
if [ -f "$file" ]; then
option="-newer $file"
fi
find ./images/ -type f -not -path "./images/comp/*" ! -name "*-no-comp.*" $option -iname "*.png" -exec sh -c '
png_file="${1/\/images\//\/images\/comp\/}"
png_dir="$(dirname "$png_file")"
mkdir -p "$png_dir"
cp "$1" "${png_file}"
optipng -o7 "${png_file}"
advpng -z4 "${png_file}"
pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow "${png_file}"
' _ {} \;
find ./images/ -type f -not -path "./images/comp/*" ! -name "*-no-comp.*" $option -iregex '.*\.\(jpg\|jpeg\)' -exec sh -c '
jpg_file="${1/\/images\//\/images\/comp\/}"
jpg_dir="$(dirname "$jpg_file")"
mkdir -p "$jpg_dir"
cp "$1" "${jpg_file}"
jpegoptim --all-progressive "${jpg_file}"
' _ {} \;
find ./images/comp -type f -iregex '.*\.\(jpg\|jpeg\|png\)' -not -iregex '.*no-comp\.\(jpg\|jpeg\|png\)' $option -exec sh -c '
webp_file="${1/\/images\/comp\//\/images\/webp\/}"
webp_dir="$(dirname "$webp_file")"
mkdir -p "$webp_dir"
cwebp -mt -af -progress -m 6 -q 75 -pass 10 "$1" -o "${webp_file%.*}.webp"
' _ {} \;
touch $file
echo "$(date)" > $file