mix ...
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Simon 2020-05-11 18:03:50 +02:00
parent 3424b56452
commit d101ca8d0f
6 changed files with 67 additions and 18 deletions

View File

@ -30,7 +30,7 @@ steps:
image: registry.lamelio.fr/hugo
commands:
- ./run install
- ./run build
- ./run build staging
when:
branch:
- master

View File

@ -0,0 +1 @@
baseURL: http://127.0.0.1:1313/

View File

@ -0,0 +1 @@
baseURL: https://lowtechweb.com/

View File

@ -0,0 +1 @@
baseURL: https://staging.lowtechweb.com/

80
run
View File

@ -13,35 +13,81 @@ echo "││┌─┬┬┬┐└┐┌┴┬─┤└┐││││├─┤
echo "│└┤┼││││░││┴┤─┤│││││││┴┤┼│"
echo "└─┴─┴──┘░└┴─┴─┴┴┘└─┴─┴─┴─┘"
echo
echo
build_production() {
echo "👷 Construction du site en mode production"
rm -rf public
hugo --environment production --minify
node themes/hugo-theme-lowtech/scripts/typo
}
build_staging() {
echo "👷 Construction du site en mode staging"
rm -rf public
hugo --environment staging -D --minify
node themes/hugo-theme-lowtech/scripts/typo
}
help() {
echo "💡 Aide"
echo "-------"
echo
echo "Commandes :"
echo "- ./run install 📦 Installation des dépendances"
echo "- ./run dev 🚧 Lancement du serveur pour le développement"
echo "- ./run dev production 🚧 Lancement du serveur pour le développement sans les brouillons"
echo "- ./run build production 👷 Construction du site en mode production"
echo "- ./run build staging 👷 Construction du site en mode staging"
echo "- ./run docker 🐳 Création de l'image Docker"
echo "- ./run deploy 🚀 Déploiement avec docker-compose"
echo
}
install() {
echo "📦 Installation des dépendances"
echo "-------------------------------"
echo
echo "- Récupération du theme"
git submodule update --init
echo "- Installation des dépendances node du theme"
cd themes/hugo-theme-lowtech && npm i
}
if [ $# -ge 1 ]; then
if [ $1 == "dev" ]; then
hugo server -D
if [ $# -ge 2 ] && [ $2 == "production" ]; then
echo "🚧 Lancement du serveur pour le développement sans les brouillons"
hugo server
else
echo "🚧 Lancement du serveur pour le développement"
hugo server -D
fi
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"
if [ $# -ge 2 ] && [ $2 == "staging" ]; then
build_staging
elif [ $# -ge 2 ] && [ $2 == "production" ]; then
build_production
else
echo "💥 Il faut choisir l'environnement (production ou staging)"
echo
help
fi
elif [ $1 == "docker" ]; then
echo "🐳 Création de l'image Docker"
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
elif [ $1 == "deploy" ]; then
echo "🚀 Déploiement avec docker-compose"
echo
docker-compose up -d
elif [ $1 == "install" ]; then
echo "- Initialisation de git submodule"
git submodule update --init
echo "- Installe les dépendances node"
cd themes/hugo-theme-lowtech && npm i
install
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
help
fi
END=`date +%s`