build.sh 629 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # 版本号
  3. version="gen"
  4. # 构建目录
  5. dist_dir="dist"
  6. # 输出目录
  7. target_dir="$dist_dir/$version"
  8. echo "开始构建..."
  9. cd front
  10. rm -rf dist/*
  11. npm run build:prod
  12. echo "复制dist文件内容到gen/src/main/resources/public"
  13. rm -rf ../gen/src/main/resources/public/*
  14. cp -r dist/* ../gen/src/main/resources/public
  15. cd ..
  16. mvn clean package
  17. echo "复制文件到$target_dir"
  18. rm -rf $dist_dir
  19. mkdir -p $target_dir
  20. cp -r gen/target/*.jar $target_dir/gen.jar
  21. cp -r script/* $target_dir
  22. cp -r db/gen.db $target_dir/gen.db
  23. echo "打成zip包"
  24. cd $dist_dir
  25. zip -r -q "$version.zip" $version
  26. echo "构建完毕"