diff --git a/Jenkinsfile.ios b/Jenkinsfile.ios index dbe8d8c9..f6185a85 100644 --- a/Jenkinsfile.ios +++ b/Jenkinsfile.ios @@ -94,31 +94,46 @@ pipeline { } } - stage('清理旧构建') { - steps { - sh "rm -rf dist/" // 清理 UniApp 打包生成的 dist 目录 - } - } + stage('安装iOS证书 & 描述文件') { steps { sh ''' # 解锁系统钥匙串(必须!) security unlock-keychain -p ${MAC_LOGIN_PWD} ~/Library/Keychains/login.keychain-db + # 导入 p12 证书到系统 + security import ${P12_FILE} \\ + -k ~/Library/Keychains/login.keychain-db \\ + -P ${P12_PASSWORD} \\ + -A \\ + -t cert + + # 允许Xcode调用签名 + security set-key-partition-list \\ + -S apple-tool:,apple:,codesign: \\ + -s -k ${MAC_LOGIN_PWD} \\ + ~/Library/Keychains/login.keychain-db + + # 安装描述文件到系统目录 + mkdir -p ~/Library/MobileDevice/Provisioning\\ Profiles + cp ${PROFILE_FILE} ~/Library/MobileDevice/Provisioning\\ Profiles/ + + echo "✅ 证书 + 描述文件 安装完成!" ''' } } - stage('开始归档项目') { - steps { - sh """ - xcodebuild archive \\ - -project ${APP_DIR}/${PROJECT_NAME}.xcodeproj \\ - -scheme ${SCHEME_NAME} \\ - -configuration ${CONFIGURATION} \\ - -archivePath ${ARCHIVE_PATH} - """ - } - } +// stage('开始归档项目') { +// steps { +// sh """ +// xcodebuild archive \\ +// -project ${APP_DIR}/${PROJECT_NAME}.xcodeproj \\ +// -scheme ${SCHEME_NAME} \\ +// -configuration ${CONFIGURATION} \\ +// -archivePath ${ARCHIVE_PATH} +// """ +// +// } +// } } post {