50 lines
1.5 KiB
Bash
Executable File
50 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# -e Exit immediately if a command exits with a non-zero status.
|
|
# -u Treat unset variables as an error when substituting.
|
|
set -eu
|
|
|
|
START=`date +%s`
|
|
PROJECT=lowtechweb
|
|
|
|
echo
|
|
echo "┌┐░░░░░░┌──┐░░┌┐░┌┬─┬┐░┌┐░"
|
|
echo "││┌─┬┬┬┐└┐┌┴┬─┤└┐││││├─┤└┐"
|
|
echo "│└┤┼││││░││┴┤─┤│││││││┴┤┼│"
|
|
echo "└─┴─┴──┘░└┴─┴─┴┴┘└─┴─┴─┴─┘"
|
|
echo
|
|
|
|
if [ $# -ge 1 ]; then
|
|
if [ $1 == "dev" ]; then
|
|
hugo server -D
|
|
elif [ $1 == "build" ]; then
|
|
rm -rf public
|
|
hugo -D --minify
|
|
node themes/hugo-theme-lowtech/scripts/typo
|
|
elif [ $1 == "deploy" ]; then
|
|
echo "😎 Commence le déploiement du site"
|
|
echo
|
|
echo "- Construction de l'image docker 🚀"
|
|
docker build . -t kosssi/$PROJECT
|
|
docker tag kosssi/$PROJECT registry.lamelio.fr/$PROJECT
|
|
docker push registry.lamelio.fr/$PROJECT
|
|
docker-compose up -d
|
|
elif [ $1 == "install" ]; then
|
|
echo "- Initialisation de git submodule"
|
|
git submodule init
|
|
echo "- Installe les dépendances node"
|
|
nvm use
|
|
cd themes/hugo-theme-lowtech && npm i
|
|
fi
|
|
else
|
|
echo "Commands:"
|
|
echo "- ./run install : Installe les dépendances"
|
|
echo "- ./run dev : Lance hugo pour le développement avec l'autoreload"
|
|
echo "- ./run build : Lance la génération du site pour la prod"
|
|
echo "- ./run deploy : Lance le déploiement du site"
|
|
echo
|
|
fi
|
|
|
|
END=`date +%s`
|
|
echo "✨ Done in $((END-START))s"
|