zoukankan      html  css  js  c++  java
  • linux 自动化发布脚本

    #
    GIT_HOME=/developer/git-repository/ 
    DEST_PATH=/product/frontend/ 
    #cd dir   
     if [ ! -n "$1" ];
       then
       echo -e "please enter name!"
       exit
     fi
     if [ $1 = "mall-fe" ];
       then
        echo -e "========Enter mall-fe================"
        cd $GIT_HOME$1
       else
       echo -e "not found!"
       exit
    fi
    #clear git dist
      echo -e "========Clear Git Dist================"
    rm -rf ./dist
    
    #git 
      echo -e "=======git checkout master================"
      git checkout master
      echo -e "=======git pull================"
      git pull
      echo -e "=======npm install================"
      npm install --registry=https://registry.npm.taobao.org 
    
    #npm run mydist
     echo -e "=======npm run mydist================"
     npm run mydist
     if [ -d "./dist" ];
       then
       #backup dest
       echo -e "=======dest backup================"
       mv $GEST_PATH$1/dist $DEST_PATH$1/dist.bak
       #copy
       echo -e "=======copy================"
       cp -R $DIT_HOME$1/dist $DEST_PATH$1
       #echo result
       echo "======= Deploy Success================"
       else
       echo "======= Deploy Error================"
       fi

    注意[]里的参数要有空格

    不加空格会报错

     if [ -d "./dist" ];
    在npm run dist 的过程中报错,可能是js文件编码不规范造成的,修改删除一些没必要的代码后就可以了
  • 相关阅读:
    Unity中的Path对应各平台中的Path
    C#里的装箱、装箱和值类型、引用类型
    unity3D自适应分辨率
    python中的-m参数
    手动安装python包
    python生成器
    HDU 1312 Red and Black(bfs)
    HDU 2553 N皇后问题(dfs)
    HDU1043 Eight(BFS)
    UVa230 Borrowers (STL)
  • 原文地址:https://www.cnblogs.com/silences/p/8280104.html
Copyright © 2011-2022 走看看