jenkins.sh 617 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -e # 如果构建失败,则退出,不能删除旧的包
  3. if [ "$#" -ne 1 ]; then
  4. echo "Usage: $0 BUILD_ENV" >&2
  5. exit 1
  6. fi
  7. pwd
  8. echo “build env: $1”
  9. npm -v
  10. npm install --registry=https://registry.npmmirror.com
  11. npm run build:$1
  12. mkdir -p ~/project/examcloud/static-new/oe-web-v3/temp
  13. cp -r dist ~/project/examcloud/static-new/oe-web-v3/temp
  14. cd ~/project/examcloud/static-new/oe-web-v3
  15. if [ -d "dist" ]; then
  16. currentTime=$(date "+%Y%m%d%H%M%S")
  17. echo "dist backup... $currentTime"
  18. tar cf oe-web-bak-$currentTime.tar.gz dist
  19. rm -rf dist/*
  20. fi
  21. mv temp/dist .
  22. rm -rf temp
  23. echo "ok..."