wm-fontis-tibi-2023/scripts/deploy.sh
2023-07-13 13:12:19 +02:00

43 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# if RSYNC_USER or RSYNC_PASS is not set, exit
if [ -z "${RSYNC_USER}" ] || [ -z "${RSYNC_PASS}" ]; then
echo "RSYNC_USER or RSYNC_PASS not set, exiting"
exit 1
fi
excludes=""
if [ "${DRONE_BRANCH}" == "master" ]; then
excludes='--exclude=src --exclude=*.map'
echo "master deploy, excluding $excludes"
fi
# sync frontend
rsync -rlcgD --perms -i -u -v --stats --progress \
--delete \
-e "sshpass -p ${RSYNC_PASS} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22222" \
$excludes \
frontend/ \
${RSYNC_USER}@ftp1.webmakers.de:./frontend/ \
# sync images getter
rsync -rlcgD --perms -i -u -v --stats --progress \
-e "sshpass -p ${RSYNC_PASS} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22222" \
images/ \
${RSYNC_USER}@ftp1.webmakers.de:./images/
# sync api config
rsync -rlcgD --perms -i -u -v --stats --progress \
--delete \
-e "sshpass -p ${RSYNC_PASS} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22222" \
api/ \
${RSYNC_USER}@ftp1.webmakers.de:./api/
# create media directory
mkdir media
chmod 770 media
rsync -rlcgD --perms -i -u -v --stats --progress \
-e "sshpass -p ${RSYNC_PASS} ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 22222" \
media \
${RSYNC_USER}@ftp1.webmakers.de:./