container-code-update.sh 887 B

12345678910111213141516
  1. #!/bin/bash
  2. # 更新代码
  3. cd /code && git fetch origin $PROGINN_BRANCH
  4. cd /code && git checkout -f origin/$PROGINN_BRANCH
  5. cd /boss && git fetch origin $ROOTER_BRANCH
  6. cd /boss && git checkout -f origin/$ROOTER_BRANCH
  7. cd /proginn-frontend && git fetch origin $PROGINN_FRONTEND_BRANCH
  8. cd /proginn-frontend && git checkout -f origin/$PROGINN_FRONTEND_BRANCH
  9. cd /proginn-frontend && current_git_branch_latest_id=`git rev-parse HEAD`
  10. current_git_branch_last_id=`cat /var/www/.proginn-frontend-commit-id`
  11. if [[ "$current_git_branch_latest_id" != "$current_git_branch_last_id" ]]; then
  12. echo "$current_git_branch_latest_id" > /var/www/.proginn-frontend-commit-id
  13. cd /proginn-frontend && rm -rf node_modules && npx yarn --registry=https://registry.npm.taobao.org install && npm run build
  14. cd /proginn-frontend && pm2 delete all && pm2 start npm --name proginn-frontend -- run start
  15. fi