vue-pro/yudao-admin-ui/Jenkinsfile
2021-07-25 23:31:13 +08:00

45 lines
1.1 KiB
Groovy

#!groovy
pipeline {
agent any
tools { nodejs "nodejs" }
parameters {
string(name: 'TAG_NAME', defaultValue: '', description: '')
}
environment {
APP_NAME = 'yudao-admin'
APP_PACKAGE='yudao-admin-ui'
NGINX_WORKDIR = '/home/pi/mydata/nginx/html/'
}
stages {
stage('检出') {
steps {
git url: "https://gitee.com/will-we/ruoyi-vue-pro.git",
branch: "devops"
}
}
stage('构建') {
steps {
sh 'cnpm --prefix '+ "${env.APP_PACKAGE}" +' install'
sh 'cnpm --prefix '+ "${env.APP_PACKAGE}" +' run build:prod'
}
}
stage('部署') {
steps {
sh 'rm -f ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
sh 'mkdir -p ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
sh 'cp -rf ' + "${env.APP_PACKAGE}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
sh 'tar -zcvf ' + "${env.APP_PACKAGE}" + '/'+ "${env.APP_PACKAGE}" + '.tar.gz ' + "${env.APP_PACKAGE}" + '/dist/'
archiveArtifacts "${env.APP_PACKAGE}" + '/'+ "${env.APP_PACKAGE}" + '.tar.gz'
//TODO 考虑刷新缓存的问题
}
}
}
}