From 6b3ffd45aa4d0d73d052b117e1c9c598fc471080 Mon Sep 17 00:00:00 2001 From: Home Date: Mon, 30 Mar 2026 04:16:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4jenkins=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E6=B5=81=E6=B0=B4=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile.ios | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile.ios b/Jenkinsfile.ios index ece476e0..c7239879 100644 --- a/Jenkinsfile.ios +++ b/Jenkinsfile.ios @@ -12,12 +12,15 @@ pipeline { CONFIGURATION = 'Release' // 编译模式:Release/Debug ARCHIVE_PATH = "${APP_DIR}/build/HBuilder.xcarchive" // 归档文件输出路径 + + // ====================== 证书配置 ====================== CERT_DIR = 'certificate/ios' // 证书文件存放目录 P12_FILE = "${CERT_DIR}/生产证书.p12" // 开发证书 p12 路径 P12_PASSWORD = "123456" // p12 证书导入密码 PROFILE_FILE = "${CERT_DIR}/jiaixuepro.mobileprovision" // 描述文件路径 MAC_LOGIN_PWD = "667788" // Mac 登录密码(解锁钥匙串) + EXPORT_OPTIONS_PLIST = "${CERT_DIR}/ExportOptions.plist" // 导出配置文件路径 // ====================== 手动签名必须的变量 ====================== DEVELOPMENT_TEAM = "2EP6SRRN43" // 苹果开发者团队ID @@ -119,22 +122,16 @@ pipeline { // Groovy 里拼接命令,随便写注释,不会影响 shell def xcodeCommand = [ 'xcodebuild archive', - - // 项目路径(注释随便写) + // 项目路径 "-project ${APP_DIR}/${PROJECT_NAME}.xcodeproj", - // Scheme 配置 "-scheme ${SCHEME_NAME}", - // 编译模式 Release/Debug "-configuration ${CONFIGURATION}", - // 归档输出路径 "-archivePath ${ARCHIVE_PATH}", - // 平台通用 iOS "-destination generic/platform=iOS", - // 版本号 "MARKETING_VERSION=${versionName}", "CURRENT_PROJECT_VERSION=${versionCode}", @@ -157,15 +154,33 @@ pipeline { "OTHER_CPLUSPLUS_FLAGS=''", "OTHER_SWIFT_FLAGS=''" ].join(' ') // 拼接成一行完整命令 - - // 打印最终命令(方便排查) + // 打印最终命令 echo "执行命令:${xcodeCommand}" - // 执行! sh(xcodeCommand) } } } + stage('导出IPA安装包') { + steps { + script { + // 导出 IPA 命令(自动从归档文件生成) + def exportCommand = [ + "xcodebuild -exportArchive", + "-archivePath ${ARCHIVE_PATH}", + "-exportPath ${APP_DIR}/build", + "-exportOptionsPlist ${EXPORT_OPTIONS_PLIST}", + "-allowProvisioningUpdates" + ].join(' ') + + echo "开始导出IPA:${exportCommand}" + sh(exportCommand) + + // 查看生成的文件 + sh "ls -la ${APP_DIR}/build/" + } + } + } } post {