linux服务器shell命令自动化部署脚本

release.sh内容

dirdate=`date +%Y%m%d`_`date +%H%M%S`;
base_target_url=/root/html/dist; #nginx代理静态资源跟目录
base_fe=/fe_project/; #前端项目跟目录
#git
cd ${base_fe};
git fetch -a;
git checkout $1;
git pull;
npm i;
npm run build;
#备份
cd /a/b/c//FE_update_history/;
mkdir ${dirdate};
cd ${dirdate};
mv ${base_target_url}/img ./;
mv ${base_target_url}/css ./;
mv ${base_target_url}/js ./;
mv ${base_target_url}/index.html ./;
mv ${base_target_url}/iconfont ./;
mv ${base_target_url}/jsmol ./;

# 复制
cd /a/b/c/front_end_project/dist;
cp -r ./img ${base_target_url}/;
cp -r ./css ${base_target_url}/;
cp -r ./js ${base_target_url}/;
cp -r ./index.html ${base_target_url}/;
cp -r ./iconfont ${base_target_url}/;
cp -r ./iconfontImage ${base_target_url}/;
cp -r ./jsmol ${base_target_url}/;

你可能感兴趣的:(自动化,ssh)