2017-03-24 01:20:54 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-09-07 17:43:54 +02:00
|
|
|
# Put all available languages here, except "en". Separated by spaces
|
2017-09-17 23:12:12 +02:00
|
|
|
TRANSLATIONS="ca de fr it nl tr zh_tw"
|
2017-09-07 17:30:43 +02:00
|
|
|
|
2017-03-24 01:20:54 +01:00
|
|
|
basedir="${0%/*}/.."
|
2017-09-07 16:59:01 +02:00
|
|
|
cd "$basedir"
|
|
|
|
mode=$1
|
2017-03-24 01:20:54 +01:00
|
|
|
|
2017-09-07 16:59:01 +02:00
|
|
|
# Unite static and language-specific config files to a single file
|
2017-09-07 17:43:54 +02:00
|
|
|
for language in $TRANSLATIONS; do
|
|
|
|
languagefiles="$languagefiles languages/strings.$language.toml"
|
|
|
|
done
|
|
|
|
cat config-static.toml languages/strings.en.toml ${languagefiles} > config.toml
|
2017-03-24 01:20:54 +01:00
|
|
|
|
|
|
|
# Execute hugo buildrun
|
2017-09-07 16:59:01 +02:00
|
|
|
if [ "$mode" == "server" ]; then
|
|
|
|
hugo server
|
2017-09-12 09:59:04 +02:00
|
|
|
elif [ "$mode" == "syntax" ]; then
|
|
|
|
hugo
|
2017-09-07 16:59:01 +02:00
|
|
|
else
|
|
|
|
hugo
|
2017-09-12 09:56:30 +02:00
|
|
|
|
2017-09-14 21:13:44 +02:00
|
|
|
##
|
|
|
|
## After building the website, we set the AWS credentials and uplodad
|
|
|
|
## everything to our AWS s3 bucket.
|
|
|
|
##
|
2017-09-15 21:03:20 +02:00
|
|
|
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
|
2017-09-07 16:59:01 +02:00
|
|
|
fi
|