37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 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 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:./
|