deploy/entrypoint.sh

15 lines
601 B
Bash
Executable File

#!/bin/sh -l
LOCAL_PATH="$1"
DEPLOY_PATH="$2"
RESTART_NGINX="$3"
rsync -hrz --delete -C --exclude=".*" -e ssh "$LOCAL_PATH" "deploy.sixohthree.com:/tmp/gitea_${GITHUB_RUN_NUMBER}_${GITHUB_SHA}"
ssh deploy.sixohthree.com "dsh -M -c -r ssh -g webs -- rsync -hvrz --delete -C -e ssh deploy.sixohthree.com:/tmp/gitea_${GITHUB_RUN_NUMBER}_${GITHUB_SHA}/ $DEPLOY_PATH"
ssh deploy.sixohthree.com "rm -rf /tmp/gitea_${GITHUB_RUN_NUMBER}_${GITHUB_SHA}"
if [ "$RESTART_NGINX" = "yes" ]; then
echo "Restarting nginx..."
ssh deploy.sixohthree.com "dsh -M -c -r ssh -g webs -- sudo systemctl reload nginx"
fi