From 17e7e59c9d22f9dcfdd7242deb9cc5412b70d395 Mon Sep 17 00:00:00 2001 From: panjunjie <46790855@qq.com> Date: Mon, 11 Aug 2025 21:18:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Jenkinsfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fd9d6e9 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +pipeline { + agent any + + environment { + DEPLOY_DIR = '/data/nginx/www/fafamall/h5' + DIST_PATH = 'dist' + } + + stages { + stage('拉取代码并验证') { + steps { + checkout scm + sh """ + [ -d "${DIST_PATH}" ] || { echo "错误:未找到 ${DIST_PATH} 文件夹"; exit 1; } + echo "${DIST_PATH} 验证通过" + """ + } + } + + stage('部署') { + steps { + sh """ + mkdir -p ${DEPLOY_DIR} + rm -rf ${DEPLOY_DIR}/* + cp -r ${DIST_PATH}/* ${DEPLOY_DIR}/ + echo "部署完成:${DIST_PATH} → ${DEPLOY_DIR}" + """ + } + } + } + + post { + success { echo "✅ 部署成功" } + failure { echo "❌ 部署失败" } + } +} \ No newline at end of file