deploy.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. #该脚本为私有化脚本,打包成内含网页的product-report-starter放在内网私服
  3. #判断node.js mvn是否存在
  4. command -v npm >/dev/null 2>&1 || { echo >&2 "I require node.js v14.16.0+ but it's not installed. Aborting."; sleep 5; exit 1; }
  5. command -v mvn >/dev/null 2>&1 || { echo >&2 "I require maven 3.5 + but it's not installed. Aborting."; sleep 5; exit 1; }
  6. cd `dirname $0`
  7. BuildDir=`pwd` #工程根目录
  8. #重置pom和index.js
  9. cat $BuildDir/build/index.js > $BuildDir/report-ui/config/index.js
  10. cat $BuildDir/build/pom.xml > $BuildDir/report-core/pom.xml
  11. echo "build web"
  12. cd $BuildDir/report-ui
  13. rm -rf dist
  14. npm install >/dev/null 2>&1
  15. npm run build:prod
  16. echo "publish web to springboot src/main/resources/static"
  17. rm -rf $BuildDir/report-core/src/main/resources/db/migration
  18. rm -rf $BuildDir/report-core/src/main/resources/static
  19. mkdir -p $BuildDir/report-core/src/main/resources/static
  20. mv $BuildDir/report-ui/dist/* $BuildDir/report-core/src/main/resources/static/
  21. echo "build springboot"
  22. cd $BuildDir/report-core
  23. mvn clean deploy -DskipTests
  24. rm -rf $BuildDir/report-core/src/main/resources/static
  25. git reset --hard