c4k-website/infrastructure/c4k-website-build/image/resources/entrypoint.sh
erik ee9e11eb04 Implement API call to check commit hash
We now download a few kb of commit info and check for changes
in the hash first, before downloading the full zip.
Also use the clojure:lein image in test.
2022-12-09 10:13:51 +01:00

36 lines
759 B
Bash
Executable file

#!/bin/bash
mkdir $BUILDDIR
mkdir $SOURCEDIR
set -euo pipefail
source /usr/local/bin/functions.sh
filename="website.zip"
hashfilename="hashfile"
echo "Check for new content"
touch $HASHFILEDIR/$hashfilename
currentHash=$( cat $HASHFILEDIR/$hashfilename )
newHash=$( get-hash-data )
if [[ $currentHash == $newHash ]]
then
echo "Nothing to do"
else
write-hash-data $currentHash $hashfilename
echo "Downloading website data"
get-website-data $filename
unzip-website-data $filename
echo "Executing Custom Scripts, if applicable"
execute-scripts-when-existing
echo "Building website"
build-website
echo "Moving files"
move-website-files-to-target
fi