Initial commit
This commit is contained in:
24
deploy.sh
Executable file
24
deploy.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Configuration
|
||||
DEST_USER="root"
|
||||
DEST_HOST="server-main.home.arpa"
|
||||
DEST_DIR="/var/lib/www/richard.dern.ovh/"
|
||||
HUGO_ENV="production"
|
||||
TARGET_OWNER="caddy:caddy"
|
||||
|
||||
echo "==> Génération du site Hugo pour l'environnement $HUGO_ENV (avec nettoyage de destination)"
|
||||
hugo --environment "$HUGO_ENV" --cleanDestinationDir
|
||||
|
||||
echo "==> Synchronisation du site vers le serveur $DEST_HOST"
|
||||
rsync -avz --delete \
|
||||
--exclude='*/data/' \
|
||||
--no-owner --no-group \
|
||||
--checksum \
|
||||
public/ "$DEST_USER@$DEST_HOST:$DEST_DIR"
|
||||
|
||||
echo "==> Correction des droits sur le serveur"
|
||||
ssh "$DEST_USER@$DEST_HOST" "chown -R $TARGET_OWNER '$DEST_DIR'"
|
||||
|
||||
echo "==> Déploiement terminé avec succès."
|
||||
Reference in New Issue
Block a user