c4k-website/infrastructure/c4k-website-build/image/resources/entrypoint.sh

52 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/bash
2022-12-02 10:56:21 +00:00
# curl -s -H "Authorization: token d92668fff6e005582dcb09c6590982a39b2523fc" https://repo.prod.meissa.de/api/v1/repos/meissa-intern/meissa-io/git/commits/HEAD | jq '.'
mkdir $BUILDDIR
mkdir $SOURCEDIR
set -o nounset
set -o xtrace
set -o errexit
set -eo pipefail
source /usr/local/bin/functions.sh
filename="website.zip"
hashfilename="hashfile"
# download website data
2022-12-02 10:56:21 +00:00
# create empty hashfile
# compare current hash to hashfile
# same?
# do nothing
# not same?
# overwrite hashfile with new hash
# unzip website
# execute scripts (if applicable)
# build website
# move files
echo "Downloading website data"
2022-12-02 09:04:09 +00:00
get-website-data $filename
echo "Check for new content"
currentHash=$( print-hash-from-file $filename )
2022-12-02 10:33:27 +00:00
touch $HASHFILEDIR/$hashfilename
if [[ $currentHash == $(cat $HASHFILEDIR/$hashfilename) ]]
then
echo "Nothing to do"
else
write-hashfile $currentHash $hashfilename
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