vue-pro/yudao-ui-admin/Jenkinsfile

45 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-07-25 01:24:50 +08:00
#!groovy
pipeline {
agent any
tools { nodejs "nodejs" }
parameters {
string(name: 'TAG_NAME', defaultValue: '', description: '')
}
environment {
2021-07-25 19:43:31 +08:00
APP_NAME = 'yudao-admin'
2021-07-27 21:42:08 +08:00
PROJECT_DIR='yudao-admin-ui'
2021-07-25 01:24:50 +08:00
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 {
2021-07-27 21:42:08 +08:00
sh 'cnpm --prefix '+ "${env.PROJECT_DIR}" +' install'
sh 'cnpm --prefix '+ "${env.PROJECT_DIR}" +' run build:prod'
2021-07-25 01:24:50 +08:00
}
}
stage('部署') {
steps {
2021-07-25 23:31:13 +08:00
sh 'rm -f ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
2021-07-25 19:08:01 +08:00
sh 'mkdir -p ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
2021-07-27 21:42:08 +08:00
sh 'cp -rf ' + "${env.PROJECT_DIR}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
sh 'tar -zcvf ' + "${env.PROJECT_DIR}" + '/'+ "${env.PROJECT_DIR}" + '.tar.gz ' + "${env.PROJECT_DIR}" + '/dist/'
archiveArtifacts "${env.PROJECT_DIR}" + '/'+ "${env.PROJECT_DIR}" + '.tar.gz'
2021-07-25 01:24:50 +08:00
//TODO 考虑刷新缓存的问题
}
}
}
}