add Jenkinsfile for Jenkins deploy
添加 Jenkins 部署文件 Signed-off-by: panjunjie <46790855@qq.com>
This commit is contained in:
parent
744579a692
commit
5a7a610104
47
Jenkinsfile
vendored
Normal file
47
Jenkinsfile
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
tools {
|
||||||
|
nodejs 'NodeJS16'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('拉取代码') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('安装依赖') {
|
||||||
|
steps {
|
||||||
|
sh 'npm install'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('构建项目') {
|
||||||
|
steps {
|
||||||
|
sh 'npm run build'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('部署项目') {
|
||||||
|
steps {
|
||||||
|
// 这里根据实际情况修改部署命令
|
||||||
|
sh '''
|
||||||
|
# 将dist目录拷贝到Nginx或其他Web服务器
|
||||||
|
rm -rf /data/nginx/www/fafamall/demo/*
|
||||||
|
cp -r dist/* /data/nginx/www/fafamall/demo//
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo 'Vue项目部署成功!'
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo 'Vue项目部署失败!'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user