Commit 98e47a70 authored by 智勇's avatar 智勇

qahome deploy sh

parent 3d0376b0
project_name=$1
tag=`date +%Y%m%d%H%M%S`
target_user='root'
target_ip='172.30.220.22'
target_dir='/home/quant_group/qahome-diamond'
qaapi='http://172.30.220.22:3003'
git_path=`curl -s "${qaapi}/proconfig/get_info?system_name=${project_name}&key=git_path"`
build_command=`curl -s "${qaapi}/proconfig/get_info?system_name=${project_name}&key=build_command"`
if [ ! -d "$project_name" ];then
echo "not exist"
git clone ${git_path}
cd ./${project_name}
else
echo "exist"
cd ./${project_name}
git pull
fi
npm install
$build_command
tar zcf ${tag}.dist.tgz ./dist/
scp ${tag}.dist.tgz ${target_user}@${target_ip}:${target_dir}
ssh ${target_user}@${target_ip} "mkdir ${target_dir}/${tag}"
ssh ${target_user}@${target_ip} "tar zxf ${target_dir}/${tag}.dist.tgz -C /${target_dir}/${tag}"
ssh ${target_user}@${target_ip} "rm -rf ${target_dir}/dist"
ssh ${target_user}@${target_ip} "ln -s ${target_dir}/${tag}/dist/ ${target_dir}/dist"
ssh ${target_user}@${target_ip} "rm -rf ${target_dir}/*.dist.tgz"
echo "done"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment