lila/bin/prod/deploy-assets
2019-07-27 18:23:29 +02:00

48 lines
1 KiB
Bash
Executable file

#!/bin/sh -e
. bin/lilarc
to=$1
mode=${2-build} # build | css | js | upload
if [ -z $to ]; then
echo "Empty deploy target"
exit 1
elif [ $to = "main" ]; then
REMOTE="leess"
REMOTE_DIR="/home/lichess-deploy"
elif [ $to = "stage" ]; then
REMOTE="khiaw"
REMOTE_DIR="/home/lichess-stage"
elif [ $to = "greco" ]; then
REMOTE="greco"
REMOTE_DIR="/home/lichess-deploy"
elif [ $to = "leess" ]; then
REMOTE="leess"
REMOTE_DIR="/home/lichess-deploy"
else
echo "Unknown deploy target $mode"
exit 1
fi
lilalog "Deploy prod $mode assets to $to server $REMOTE:$REMOTE_DIR"
if [ "$mode" != "upload" ]; then
./ui/build prod $mode
fi
lilalog "Rsync scripts"
rsync --archive --no-o --no-g --progress --exclude '*.dev.css' public $REMOTE:$REMOTE_DIR
# SSH_COMMAND="chown -R lichess:lichess $REMOTE_DIR"
# echo $SSH_COMMAND
# ssh $REMOTE $SSH_COMMAND
lilalog "Deploy complete"
if [ $to = "main" ]; then
xdg-open https://lichess.org/dev/cli
fi
if [ $to = "stage" ]; then
xdg-open https://lichess.dev/dev/cli
fi