test_react_hook/hooks.sh
2020-05-07 14:04:20 +07:00

55 lines
1.1 KiB
Bash

#!/bin/sh
echo $PWD
while read oldrev newrev ref
do
CURRENT_BRANCH=`echo $ref | cut -d/ -f3`
done
TARGET="/home/git/pub/test_react_hook"
TEMP="/home/git/tmp/test_react_hook"
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
HEROKU_APP_NAME="react-host-test"
API_KEY=d282975b-22ba-48f1-9bbe-a1a22bec5543
echo "Current Branch : $CURRENT_BRANCH"
if [ CURRENT_BRANCH != "publish" ]
then
echo "Not Publish"
exit;
fi
cd ..
REPO="$PWD/test_react_hook.git"
mkdir -p $TEMP
git --work-tree=$TEMP --git-dir=$REPO checkout -f
cd $TEMP
echo "Start Install Project Dependencies"
yarn install
echo "Start Building Project"
yarn build
echo "Push Project To Heroku"
echo "-- Start Login Heroku Containers Registry"
HEROKU_API_KEY=$API_KEY heroku container:login
echo "-- Start Push App To Heroku"
HEROKU_API_KEY=$API_KEY heroku container:push -a $HEROKU_APP_NAME web
echo "-- Start Release App on Heroku"
HEROKU_API_KEY=$API_KEY heroku container:release -a $HEROKU_APP_NAME web
echo "-- Infomation "
HEROKU_API_KEY=$API_KEY heroku apps:info -a $HEROKU_APP_NAME
rm -rf $TEMP