在linux环境安装git、npm等工具,拉好项目,装好包后新建个xx.sh的脚本文件,在linux中执行这个文件就好了,命令示例如下
#!/bin/bash
echo -e "\n"
echo $(date +"%Y-%m-%d %H:%M:%S") "开始部署TMS前端工程..."
su - vue -s /bin/bash shell.sh
echo $(date +"%Y-%m-%d %H:%M:%S") "切换到vue用户"
echo $(date +"%Y-%m-%d %H:%M:%S") "开始build tms-mgt代码..."
cd /apply/zallsteel-tms-mgt-static
git reset --hard
git pull origin 1.0.9
echo $(date +"%Y-%m-%d %H:%M:%S") "更新tms-mgt代码完成,开始build..."
#npm install
npm run build:prod
echo $(date +"%Y-%m-%d %H:%M:%S") "build tms-mgt代码完成\n"
echo $(date +"%Y-%m-%d %H:%M:%S") "开始build tms-customer代码..."
cd /apply/zallsteel-tms-customer-static
git reset --hard
git pull origin 1.0.9
echo $(date +"%Y-%m-%d %H:%M:%S") "更新tms-customer代码完成,开始build..."
#npm install
npm run build:prod
echo $(date +"%Y-%m-%d %H:%M:%S") "build tms-customer代码完成"
exit