package_name="dist_${JOB_NAME}_${BUILD_NUMBER}.zip" echo ${package_name} pwd node -v npm -v #npm --registry https://registry.npm.taobao.org install npm install --registry=http://1.1.1.*:8082/repository/nexus-npm/ #npm i #npm run dev npm run build:staging zip -r -q ${package_name} ./dist/**
package_name="dist_${JOB_NAME}_${BUILD_NUMBER}.zip"
# 上面脚本打包好的静态资源 local_dir="/data/galaxy/jenkins/jenkins-2.382/jenkins-home/workspace/${JOB_NAME}/${package_name}"
# 要部署的地址 server_ip="*.*.*.*"
# 要部署服务器的位置 remote_dir="/data/galaxy/frontend-web/venus-sw" # 远端发送操作 scp ${local_dir} galaxy@${server_ip}:${remote_dir} # 登陆部署的服务器 ssh -q -oStrictHostKeyChecking=no galaxy@${server_ip} <<EOF
cd ${remote_dir} mv dist dist_bak_${JOB_NAME}_${BUILD_NUMBER} unzip ${package_name} chmod -R 777 dist EOF pwd rm -rf $(ls dist*.zip) echo "打包success"
标签:npm,shell,dist,name,package,dir,jenkins,打包 From: https://www.cnblogs.com/wingring/p/17000015.html