Jenkins实现开发前端VUE项目自动化打包发布
node('slave-191') { stage('从SVN拉取代码') { checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: '用户名和密码ID', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'svn项目链接']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']]) } stage("Install") { sh '''export Node_Home=/usr/local/node-v12.13.1 export PATH="$PATH:$Node_Home/bin" $Node_Home/bin/cnpm install''' } stage('NPM打包') { sh '''export Node_Home=/usr/local/node-v12.13.1 export PATH="$PATH:$Node_Home/bin" $Node_Home/bin/npm run build''' } stage("更改API接口地址") { sh '''sed -i 's/ip1/ip2/g' ${WORKSPACE}/dist/static/config.js ''' } stage("打包dist并归档") { sh '''tar -zcvf dist.tar.gz dist/ ''' archiveArtifacts artifacts: '*.tar.gz', fingerprint: true } stage('部署包') { sh ''' cp -r ${WORKSPACE}/dist/ /usr/local/nginx/html/ ''' } stage('测试服务启动') { sh '''running_num=`/usr/bin/systemctl status nginx| grep running | wc -l` if [ $running_num -eq 1 ];then echo "deploy success" else echo "deploy failed" exit 1 fi ''' } }
4.构建结果
创新互联是专业的槐荫网站建设公司,槐荫接单;提供成都做网站、网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行槐荫网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
网站名称:Jenkins实现开发前端VUE项目自动化打包发布
URL地址:http://lswzjz.com/article/jpiccj.html