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.
36 lines
879 B
36 lines
879 B
#!/usr/bin/env bash
|
|
|
|
#use the right command to install packages
|
|
if [ "$(command -v apt)" ]; then CMD=apt; else CMD=yum; fi
|
|
|
|
echo "installing packages..."
|
|
eval $CMD update > /dev/null
|
|
eval $CMD -y install openssh-client openssh-clients > /dev/null
|
|
echo "done."
|
|
|
|
mkdir /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
|
|
|
|
case "$DRONE_BRANCH" in
|
|
"dev")
|
|
export USER=maxime
|
|
export IP=92.132.18.192
|
|
export DIR=server/TBasket/backend
|
|
;;
|
|
"production")
|
|
export USER=palafour
|
|
export IP=193.49.118.205
|
|
export DIR=TBasket/backend
|
|
;;
|
|
"")
|
|
echo "DRONE_BRANCH 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 |