publiccode.si/site/build/build.sh

40 lines
947 B
Bash
Raw Normal View History

#!/bin/bash
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.."
cd "$basedir"
mode=$1
# Execute hugo buildrun
if [ "$mode" == "server" ]; then
hugo server
2017-09-12 09:59:04 +02:00
elif [ "$mode" == "syntax" ]; then
hugo
else
status=1
tries=0
while [[ $status -ne 0 ]]; do
2017-09-12 09:56:30 +02:00
hugo
status=$?
(( tries++ ))
if [[ $status != 0 && $tries -le 2 ]]; then
echo "Build error with exit status $status on try $tries. Try again now"
elif [[ $status != 0 && $tries -gt 2 ]]; then
echo "Build failed 3 times in a row. Don't try again."
exit 1
fi
done
2018-03-24 23:44:12 +01:00
## After successfully building the website, we set the AWS credentials and upload
2017-09-14 21:13:44 +02:00
## everything to our AWS s3 bucket.
##
#if [ -f /srv/cred/aws.sh ]; then
# . /srv/cred/aws.sh
# /usr/local/bin/aws configure set default.s3.max_concurrent_requests 2
# /usr/local/bin/aws s3 cp /usr/share/blog/public/ s3://aws-website-pmpc-soegm/ --recursive
#fi
fi