website/Jenkinsfile
panjunjie 220e49cfb4 更新 Jenkinsfile
修改 Jenkins 的部署配置
2025-08-10 21:44:21 +08:00

57 lines
1.2 KiB
Groovy

pipeline {
agent any
tools {
nodejs 'NodeJS22'
}
stages {
stage('拉取代码') {
steps {
checkout scm
}
}
stage('检查Node.js版本') {
steps {
sh 'node -v'
sh 'npm -v'
}
}
stage('安装依赖') {
steps {
sh '''
rm -rf node_modules package-lock.json
npm config set registry https://registry.npmmirror.com
npm install
npm install postcss-px-to-viewport-8-plugin@1.1.3 --save-dev
'''
}
}
stage('构建项目') {
steps {
sh 'npm run build'
}
}
stage('部署项目') {
steps {
sh '''
rm -rf /data/nginx/www/fafamall/demo/*
cp -r dist/* /data/nginx/www/fafamall/demo//
'''
}
}
}
post {
success {
echo 'Vue项目部署成功'
}
failure {
echo 'Vue项目部署失败'
}
}
}