container-code-update.sh 922 B

123456789101112131415161718
  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-user && git fetch origin dev
  8. cd /proginn-user && git checkout -f origin/dev
  9. cd /proginn-frontend && git fetch origin $PROGINN_FRONTEND_BRANCH
  10. cd /proginn-frontend && git checkout -f origin/$PROGINN_FRONTEND_BRANCH
  11. cd /proginn-frontend && current_git_branch_latest_id=`git rev-parse HEAD`
  12. current_git_branch_last_id=`cat /var/www/.proginn-frontend-commit-id`
  13. if [[ "$current_git_branch_latest_id" != "$current_git_branch_last_id" ]]; then
  14. echo "$current_git_branch_latest_id" > /var/www/.proginn-frontend-commit-id
  15. cd /proginn-frontend && rm -rf node_modules && npx yarn --registry=https://registry.npm.taobao.org install
  16. cd /proginn-frontend && pm2 reload ecosystem.config.yml
  17. fi