Mise à jour du script de publication

This commit is contained in:
nono 2022-02-27 17:40:55 +01:00
parent ddfa39475d
commit e6ba2b0a47

View File

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# This script will publish the compiled output of the blog
# as it is now in this directory.
@ -5,28 +7,41 @@
# making a git branch at this point, or a git tag
# to enable rollbacks.
# Make errors be fatal
set -e
WEBSITE_URL="https://n07070.xyz"
echo ">> Update the remotes..."
# Last blog version
git pull origin master
# Get last theme version
git submodule foreach git pull origin master
git submodule foreach git pull origin main
# 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
# Commented, because colors is nice, and dithering actually brings more issues than it solves:
# Images size tends to be bigger, relative to quality,
# It's not easy for some people to see the image that way,
# It's more trouble than it's worth.
# echo ">> Dithering the images..."
# ## 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
echo ">> Generating the openring..."
openring -s https://www.laquadrature.net/feed -s -s https://solar.lowtechmagazine.com/feeds/all-en.rss.xml < themes/blogotheme/layouts/partials/openring-in.html > themes/blogotheme/layouts/partials/openring-out.html
echo ">> Building the website..."
hugo --themesDir themes --theme blogotheme --baseURL="https://n07070.xyz" --enableGitInfo --minify --templateMetrics
echo ">> All done !"