ios jenkins配置实现iOS项目自动化打包

1.jenkins安装步骤省略,网上很多教程都可以的

2.话不多说直接上图看jenkins配置

新建任务

在源码管理中选择git或svn,我这里是svn

 

 

 

 

 

 

 

 

最后在执行shell中写

#bin/bash -l
export LANG=en_US.UTF-8

export LANGUAGE=en_US.UTF-8

export LC_ALL=en_US.UTF-8

pod install --verbose --no-repo-update
/usr/local/bin/carthage update --platform ios 

# 工程名

APP_NAME="SFA3"
# 证书,如果自动选择证书,设为“iPhone Developer”即可

CODE_SIGN_DEVELOPER="iPhone Developer"

# info.plist路径

project_infoplist_path="./${APP_NAME}/Info.plist"

#取版本号

bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" "${project_infoplist_path}")

#取build值

bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" "${project_infoplist_path}")

DATE="$(date +%Y%m%d)"

IPANAME="${APP_NAME}_V${bundleShortVersion}_${DATE}.ipa"

#要上传的ipa文件路径

IPA_PATH="$HOME/${IPANAME}"

echo ${IPA_PATH}

#集成有Cocopods的用法

echo "=================clean================="

xcodebuild clean -project "${APP_NAME}.xcodeproj" -scheme "${APP_NAME}" -configuration 'Release'
echo "+++++++++++++++++build+++++++++++++++++"

xcodebuild archive -workspace "${APP_NAME}.xcworkspace" -scheme "${APP_NAME}" -configuration 'Release' -archivePath http://xxx.xxx.xxx/svn/mis/branches//build/SFA3
echo "+++++++++++++++++xcrun+++++++++++++++++"

xcodebuild -exportArchive -archivePath "./ipa/${APP_NAME}.xcarchive" -exportPath /Users/useradmin/SFA3/ -exportOptionsPlist /Users/useradmin/SFA3/ExportOptions.plist 
 

到这里jenkins的配置已经完成,还有就是证书要配置好这里就不在演示了。

最后执行后会生成ipa文件

但我这里最后还有个报错不知道什么原因,可以用但看着很不爽,有知道的大佬可以告知下

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Jenkins集成IOS全自动打包可以使用Jenkins Pipeline来实现。下面是一些基本步骤: 1. 安装JenkinsiOS插件:确保您的Jenkins服务器已经安装并配置Jenkins,并且已经安装了相关的iOS插件。 2. 创建Pipeline:在Jenkins中创建一个新的Pipeline,用于自动化IOS打包过程。 3. 配置环境:在Pipeline中配置所需的构建环境,包括iOS开发环境、模拟器等。 4. 编写脚本:使用Jenkins Pipeline的Groovy语言编写脚本,实现IOS自动打包的过程。可以使用Xcode命令行工具来执行打包操作,例如使用`xcodebuild`命令。 以下是一个简单的示例脚本,用于自动化IOS打包过程: ```groovy stage('Build') { steps { sh 'xcodebuild -project YourProject.xcodeproj -scheme YourScheme -configuration Release clean build' } } stage('Archive') { steps { archiveFile(file: 'YourApp.ipa', pattern: '**/*.ipa') { sh 'xcodebuild -exportArchive -archivePath build/Release-iphoneos/YourScheme.ipa -exportOptionsPlist export.plist -allowProvisioningUpdates' } } } ``` 这个脚本会在构建阶段使用`xcodebuild`命令清理并构建项目,并在归档阶段使用`xcodebuild`命令导出ipa文件。您可以根据需要修改脚本中的命令和参数,以适应您的项目配置。 5. 触发Pipeline:在Jenkins配置相应的触发器,例如触发器时添加iOS项目目录作为输入源,然后在Jenkins Pipeline中自动执行打包操作。 以上是一些基本步骤,您可以根据您的实际需求进行调整和扩展。请注意,自动打包过程可能需要一些额外的配置和步骤,具体取决于您的项目和开发环境。另外,为了确保自动打包过程的可靠性,您可能需要测试和验证脚本,以确保它在不同的环境中都能够正常运行。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值