FlowPacs/yudao-admin-ui/Jenkinsfile

43 lines
1.0 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:08:01 +08:00
APP_NAME = '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 {
sh 'cnpm --prefix '+ "${env.APP_NAME}" +' install'
2021-07-25 11:38:18 +08:00
sh 'cnpm --prefix '+ "${env.APP_NAME}" +' run build:prod'
2021-07-25 01:24:50 +08:00
}
}
stage('部署') {
steps {
2021-07-25 19:08:01 +08:00
sh 'mkdir -p ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
2021-07-25 16:24:45 +08:00
sh 'cp -rf ' + "${env.APP_NAME}" + '/dist/. ' + "${env.NGINX_WORKDIR}" + "${env.APP_NAME}"
2021-07-25 01:24:50 +08:00
sh 'tar -zcvf ' + "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz ' + "${env.APP_NAME}" + '/dist/'
archiveArtifacts "${env.APP_NAME}" + '/'+ "${env.APP_NAME}" + '.tar.gz'
//TODO 考虑刷新缓存的问题
}
}
}
}