-
Notifications
You must be signed in to change notification settings - Fork 0
/
.liftoff.sh
executable file
·44 lines (37 loc) · 1.27 KB
/
.liftoff.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Load environment variables from .env file
if [ -f ./.env ]; then
export $(cat ./.env | sed 's/#.*//g' | xargs)
fi
################## CHANGE ME ########################
TO_DEPLOY="./_site" #Build path of Jekyll - default: _site
USER="$SERVER_USER" #SERVER user goes here - if not root
REMOTE="$SERVER_IP" #SERVER IP goes here
REMOTE_PATH="$SERVER_PATH" #PATH on REMOTE SERVER
REMOTE2="$REMOTE"
REMOTE_PATH2="$REMOTE_PATH"
EXCLUDE=('.*')
####################################################
################## DONT EDIT BELOW 👀 ########################
for misfits in "${EXCLUDE[@]}"; do
EXCLUDES="$EXCLUDE --exclude=$misfits"
done
if [ $# -eq 0 ]
then
echo "$MALFUNCTION"
elif [ "$1" == "ready" ]
then
if [[ -z "$2" ]]
then
echo "Running prelaunch ✅ check to 🪐 $REMOTE..."
rsync --dry-run -az --force --delete --stats --human-readable --info=progress2 $EXCLUDES -e "ssh -p22" $TO_DEPLOY "$USER"@"$REMOTE":"$REMOTE_PATH"
elif [ "$2" == "go" ]
then
echo "And we have 🚀 Liftoff to 🪐 - $REMOTE2..."
rsync -az --force --delete --stats --human-readable --info=progress2 $EXCLUDES -e "ssh -p22" $TO_DEPLOY "$USER"@"$REMOTE2":"$REMOTE_PATH2"
else
echo "$MALFUNCTION"
fi
else
echo -e "$OOPS"
fi