#!/bin/sh
BRANCH_NAME=$1
chmod 400 ec2-node.pem
ssh -o StrictHostKeyChecking=no -i ec2-node.pem ubuntu@10.229.21.132 <<EOF
    sudo su
    cd espl
    git stash
    git fetch
    git checkout $BRANCH_NAME
    git pull
    npm install
    ng build --prod  --sourceMap
    pm2 restart app
    exit
EOF
