Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- PORT=9000
- APP_NAME=""
- APP_ROOT=""
- GIT_DIR=""
- BRANCH=""
- while read oldrev newrev ref
- do
- if [[ $ref = refs/heads/"$BRANCH" ]];
- then
- echo "Stopping $APP_NAME"
- pm2 stop "${APP_NAME}"
- echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
- git --work-tree="$APP_ROOT" --git-dir="$GIT_DIR" checkout -f
- echo "Installing dependencies"
- cd "$APP_ROOT"
- yarn install
- echo "Restarting the app"
- PORT="$PORT" pm2 start ./bin/www --name "${APP_NAME}"
- echo "Build Succeeded!"
- else
- echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement