#GIT_HOME=/developer/git-repository/Dest_path=/product/frontend/#cd dirif[!-N" $" ]; Then Echo-E"Please enter name!"exit fiif[ $1="Mall-fe" ]; Then Echo-E"========enter mall-fe================"CD $GIT _home$1 ElseEcho-E"Not found!"exitfi#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 Mydistif[-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================" ElseEcho"======= Deploy error================"fi
Note that the parameters in [] must have a space
No space will be an error
If [-D "./dist" ];
In the process of NPM run Dist error, it is possible that the JS file encoding is not the norm caused, modify the deletion of some unnecessary code after you can
Linux Automation Release Scripts