jean-cloud-services/services/hugo/deploy_user.sh
2024-10-16 11:41:44 +02:00

20 lines
522 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
# Do not update website if body is unreachable
[ ! -f "$HTTP_DIR/public/index.html" ] && { curl --fail-with-body https://$RADIO_HOST/manager/ >/dev/null || exit 0 ; }
# Update git repo
git_update.sh -d "$HTTP_DIR" -o "-i $SECRET_DIR/gitlab-deploy.sshprivkey" -r "${GIT_SOURCE_BRANCH:-main}" "$GIT_SOURCE_REPO"
cd "$HTTP_DIR"
# Get remote content files
rclone_ncloud_publiclink.sh
# Invalid cache
rm -rf "/tmp/hugo_cache_$USER"
# Build website
HUGO_CACHEDIR="/tmp/hugo_cache_$USER" hugo