更新 Jenkins 配置文件及新增 web_pro 部署流程

This commit is contained in:
2024-12-20 22:04:02 +08:00
parent 45ab86252e
commit 4177da615c
2 changed files with 54 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ pipeline {
steps { steps {
echo 'Deploying...' echo 'Deploying...'
sh "cp config.xml /home/cq/web/resource_Publish/cfg/" sh "cp config.xml /home/cq/web/resource_Publish/cfg/"
sh "cp main.min_jocw9Tu2.js /home/cq/web/js/"
} }
} }
} }

53
chuanqi_web_pro_jenkins Normal file
View File

@@ -0,0 +1,53 @@
pipeline {
agent any
stages {
stage('拉取代码') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: '*/main']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[url: 'http://192.168.25.110:8999/kubbo/chuanqi-client-config.git',credentialsId:'d54e1035-acca-424e-80d0-9f7e29cab9c3']]
])
}
}
stage('打包') {
steps {
echo "正在打包的工程==>: ${params.pid}"
sh "npm i"
sh "npm run deploy"
}
}
stage('部署') {
steps {
echo 'Deploying...'
sshPublisher(publishers: [sshPublisherDesc(configName: 'tencent-SG',
transfers: [sshTransfer(
sourceFiles: "dist.zip",
execCommand: "unzip dist.zip&&mv -f main.min_jocw9Tu2.js js/&&mv -f config.xml resource_Publish/cfg/&&rm -rf dist.zip",
remoteDirectory: "/home/chuanqi/web")
], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)
])
}
}
}
post{
success {
echo 'Deployment finished successfully.'
sh """
curl 'https://api.telegram.org/bot7816434196:AAFtmbUYpUIwcb_SvBnJY0guPIOLCxp2a5s/sendMessage' \\
-x http://192.168.25.110:20171\\
-H 'Content-Type: application/json' \\
-d '{
"chat_id": "6779541681",
"text":"传奇web构建完成!",
}'
"""
}
failure {
echo 'Deployment failed.'
}
}
}