release.sh 560 Bytes
Newer Older
Michele Azzolari's avatar
Michele Azzolari committed
1
#!/usr/bin/env bash
2 3 4 5 6 7 8

if [[ ! "${FCUB_SSH_PRIVATE_KEY}" = "" ]]; then
  which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
  eval $(ssh-agent -s)
  echo "$FCUB_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
fi

9
if [[ ! "${FCUB_HOST_PUB_KEY}" = "" ]]; then
Michele Azzolari's avatar
Michele Azzolari committed
10 11 12
  mkdir -p ~/.ssh
  echo ${FCUB_HOST_PUB_KEY} >> ~/.ssh/known_hosts
fi
Michele Azzolari's avatar
Michele Azzolari committed
13
DEST_PATH=test.milanoscaloromana.it
14
if [[ "$1" = "prod" ]]; then
15
  DEST_PATH=fcub.milanoscaloromana.it
Michele Azzolari's avatar
Michele Azzolari committed
16 17
fi
rsync -av --delete --exclude data build/ fcub@www.milanoscaloromana.it:/var/www/${DEST_PATH}/