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文件
但我这里最后还有个报错不知道什么原因,可以用但看着很不爽,有知道的大佬可以告知下