You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
Backend/drone/deliver.sh

44 lines
1.0 KiB

#!/usr/bin/env bash
echo "installing packages..."
yum update > /dev/null
yum -y install openssh-clients openssh-client > /dev/null
echo "done."
rm -rf /root/.ssh
mkdir -p /root/.ssh
echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
echo "$SSH_PUBLIC_KEY" > /root/.ssh/id_rsa.pub
chmod 0600 /root/.ssh/*
chmod 700 /root/.ssh
ls -lsh /root/.ssh
ls -ld /root/.ssh
pwd
case "$1" in
"dev")
USER=maxime
IP=92.132.18.192
DIR=server/TBasket/backend
;;
"production")
USER=palafour
IP=193.49.118.205
DIR=TBasket/backend
;;
"")
echo "first argument is missing" >&2
exit 1
;;
*)
echo "branch $1 is unable to perform delivery, authorized branches are 'dev and production' for delivery." >&2
echo "delivery step skipped"
exit 0
esac
./gradlew :shadowJar
echo "making delivery onto '$USER@$IP:$DIR'"
scp -o "StrictHostKeyChecking no" "build/libs/server-all.jar" "drone/deploy.sh" "drone/start.sh" "$USER@$IP:$DIR/"
echo "chmod 700 $DIR/*; $DIR/deploy.sh" | ssh -o "StrictHostKeyChecking no" $USER@$IP