用Git托管静态页面代码,通过Jenkins部署静态页面,是再方便不过的了。本文将介绍如何通过Jenkins部署最新的静态页面代码。
一、Jenkins的配置
1.设置项目名称、参数(环境、分支)等
2.配置源码管理
3.配置构建参数
echo '当前文件夹:'${WORKSPACE}
zip -r ./coursestatistics.zip ./*
echo ${JOB_NAME}
echo ${BUILD_ID}
timeStamp=`date +%Y-%m-%d`
echo $timeStamp
mkdir -p /thirdparties/jenkins/apache-tomcat/webapps/docs/build/${JOB_NAME}/$timeStamp@${BUILD_NUMBER}
mv ${WORKSPACE}/coursestatistics.zip /thirdparties/jenkins/apache-tomcat/webapps/docs/build/${JOB_NAME}/$timeStamp@${BUILD_NUMBER}
unpacking_coursestatistics.sh内代码:
echo $ $
timeStamp=`date +%Y-%m-%d`
echo $timeStamp@$ cd /apps/statics/
wget http://localhost:/docs/build/$/$timeStamp@$/coursestatistics.zip -nH -r -N -nv cd /apps/statics/
rm -rf coursestatistics/
unzip -d coursestatistics ./docs/build/$/$timeStamp@$/coursestatistics.zip
至此,算是配置完毕了。
注: