blog/publish.sh
2021-05-29 17:19:29 +02:00

34 lines
1.5 KiB
Bash
Executable File

# This script will publish the compiled output of the blog
# as it is now in this directory.
# It could be futher improved by taking this version,
# making a git branch at this point, or a git tag
# to enable rollbacks.
WEBSITE_URL="https://n07070.xyz"
# Last blog version
git pull origin master
# Get last theme version
git submodule foreach git pull origin master
# Dither images present in the blog, moving the existing images to filename_original.jpg
## Travel down the directory content/
find content/ \ # Find from the content directory
-maxdepth 4 \ # Maximum depth of 4 dirs
-type f \ # Find only files
-name "*.jpg" \ # Find only JPEG files
-exec \ # Execute next lines
cp {} {}.original && \ # Copy file and add .original to it's filename
convert {} -colorspace GRAY -o ordered-dither o2x2 {}\ # Dither image
jpegoptim {} -S 80 -t ; # Optimize the jpeg file
# Generate the openring ( https://git.sr.ht/~sircmpwn/openring )
./openring -s https://www.laquadrature.net/feed -s https://mamot.fr/@n07070.rss -s https://solar.lowtechmagazine.com/feeds/all-en.rss.xml < in.html > openring-out.html
hugo --themesDir themes --theme blogotheme --baseURL="https://n07070.xyz" --enableGitInfo --minify --templateMetrics