container-code-update.sh 1.1 KB

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # 更新代码
  3. cd /code && git fetch origin $PROGINN_BRANCH
  4. cd /code && git checkout -f origin/$PROGINN_BRANCH
  5. cd /proginn-user && git fetch origin dev
  6. cd /proginn-user && git checkout -f origin/dev
  7. cd /proginn-work && git fetch origin dev
  8. cd /proginn-work && git checkout -f origin/dev
  9. cd /proginn-serve && git fetch origin dev
  10. cd /proginn-serve && git checkout -f origin/dev
  11. cd /boss && git fetch origin $ROOTER_BRANCH
  12. cd /boss && git checkout -f origin/$ROOTER_BRANCH
  13. cd /proginn-frontend && git fetch origin $PROGINN_FRONTEND_BRANCH
  14. cd /proginn-frontend && git checkout -f origin/$PROGINN_FRONTEND_BRANCH
  15. cd /proginn-frontend && current_git_branch_latest_id=`git rev-parse HEAD`
  16. current_git_branch_last_id=`cat /var/www/.proginn-frontend-commit-id`
  17. if [[ "$current_git_branch_latest_id" != "$current_git_branch_last_id" ]]; then
  18. echo "$current_git_branch_latest_id" > /var/www/.proginn-frontend-commit-id
  19. cd /proginn-frontend && rm -rf node_modules && npx yarn --registry=https://registry.npm.taobao.org install
  20. cd /proginn-frontend && pm2 reload ecosystem.config.yml
  21. fi