From 460ba5f112a10c8436afe8fc55c7dd67099ee182 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Sat, 9 May 2026 14:53:42 +0800 Subject: [PATCH] =?UTF-8?q?docs(deploy):=20=E6=B7=BB=E5=8A=A0=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E7=9A=84=E9=83=A8=E7=BD=B2=E6=96=87=E6=A1=A3=E5=92=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 compose.production.yaml 和 compose.production.server.yaml 部署配置 - 添加 nginx.dev.xuqinmin.com.conf 和 nginx.sentry.xuqinmin.com.conf 反向代理配置 - 创建详细的部署指南文档 deploy/README.md,涵盖架构设计和部署步骤 - 添加前端访问文档 web/README.md,包含线上地址和接口说明 - 补充平台文档总览 README.md,整合各模块文档入口 - 配置多服务容器化部署,包括 tenant-service、im-service、push-service 等 - 设置外部数据库和 Redis 连接配置,确保服务间正确通信 - 配置 WebSocket 和 API 路由转发规则,支持实时通信和版本更新服务 --- Jenkinsfile | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e61e4fa --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,111 @@ +pipeline { + agent any + + parameters { + string(name: 'BRANCH', defaultValue: 'main', description: 'Git 分支名') + string(name: 'VERSION', defaultValue: '', description: '发布版本号(留空使用 package.json 中的 version)') + booleanParam(name: 'RUN_TESTS', defaultValue: true, description: '是否运行测试') + booleanParam(name: 'PUBLISH', defaultValue: true, description: '是否发布到 Nexus npm 仓库') + } + + environment { + NEXUS_REGISTRY = 'https://nexus.xuqinmin.com/repository/npm-hosted/' + GIT_URL = 'https://xuqinmin.com/xuqinmin12/XuqmGroup-Vue3SDK.git' + NODE_VERSION = '22' + } + + options { + timeout(time: 20, unit: 'MINUTES') + buildDiscarder(logRotator(numToKeepStr: '20')) + disableConcurrentBuilds() + } + + stages { + stage('Checkout') { + steps { + checkout scm + script { + env.GIT_COMMIT_SHORT = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim() + if (params.VERSION?.trim()) { + sh "npm version ${params.VERSION} --no-git-tag-version" + } + env.PUBLISH_VERSION = sh(script: 'node -p "require(\"./package.json\").version"', returnStdout: true).trim() + } + } + } + + stage('Build Info') { + steps { + script { + echo "🚀 构建分支: ${params.BRANCH}" + echo "🏷️ 发布版本: ${env.PUBLISH_VERSION}" + echo "🔨 Git Commit: ${env.GIT_COMMIT_SHORT}" + } + } + } + + stage('Install Dependencies') { + steps { + sh 'npm ci' + } + } + + stage('Type Check') { + steps { + sh 'npm run type-check' + } + } + + stage('Build') { + steps { + sh 'npm run build' + } + } + + stage('Tests') { + when { expression { return params.RUN_TESTS } } + steps { + sh 'npm run test 2>&1 | tee test-results.txt' + } + post { + always { + archiveArtifacts artifacts: 'test-results.txt', allowEmptyArchive: true + } + } + } + + stage('Publish to Nexus') { + when { + allOf { + branch 'main' + expression { return params.PUBLISH } + } + } + steps { + withCredentials([usernamePassword(credentialsId: 'nexus-npm-credentials', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) { + sh """ + echo "//nexus.xuqinmin.com/repository/npm-hosted/:_auth=\$(echo -n '\${NPM_USER}:\${NPM_PASS}' | base64)" > .npmrc + npm publish --registry ${NEXUS_REGISTRY} + """ + } + } + } + } + + post { + success { + script { + echo "✅ Vue3 SDK v${env.PUBLISH_VERSION} 构建成功 (Commit: ${env.GIT_COMMIT_SHORT})" + if (params.PUBLISH) { + echo "📦 已发布到 Nexus npm 仓库: ${NEXUS_REGISTRY}" + } + } + } + failure { + echo "❌ Vue3 SDK 构建失败,请检查日志" + } + always { + sh 'rm -f .npmrc 2>/dev/null || true' + } + } +}