image.png
1、cocoapods更新三方库脚本
echo '/// 开始更新pod三方库'
# 根据打印路径决定是否需要cd
cd iqhiPad
pwd
#pod setup
pod install
echo '/// 更新pod三方库完成'
2、fastlane打包的脚本
#!/bin/sh
#工程名
project_name="xxxxx"
#scheme名/target名
scheme_name="xxxxxx"
#打包模式 Debug/Release
development_mode=Release
#打包环境 开发/测试/正式
environment="开发"
#当前工程绝对路径
project_path='/Users/mac/.jenkins/workspace/xxxx/xxxx'
cd $WORKSPACE/$project_name
#生成的IPA文件存放路径
DATE=`date '+%Y%m%d_%H%M%S'`
#project_path_pre=~/Desktop/ipas/$scheme_name-$DATE
project_path_pre=$WORKSPACE
#编译过程中产生的临时文件夹,build文件夹路径(等打包成功之后删除掉)
tempBuild_path=${project_path}/build
#build文件夹路径
build_path=${project_path_pre}/build
#导出.ipa文件所在路径
exportIpaPath=${project_path_pre}/IPADir/${development_mode}
# 导出.ipa所需要用到的plist文件路径
exportOptionsPlistPath=${project_path}/packageScript/exportOptions.plist
##development_mode=Test
scheme_name="iqhiPad"
environment="测试环境"
echo '/// 正在清理工程'
xcodebuild \
clean -configuration ${development_mode} -quiet || exit
echo '/// 清理完成---------'
echo '/// 开始编译工程:'${development_mode}
xcodebuild \
archive -workspace ${project_path}/${project_name}.xcworkspace \
-scheme ${scheme_name} \
-configuration ${development_mode} \
-archivePath ${build_path}/${project_name}.xcarchive -quiet || exit
echo '/// 编译完成'
echo '/// 开始导出ipa包'
xcodebuild -exportArchive -archivePath ${build_path}/${project_name}.xcarchive \
-configuration ${development_mode} \
-exportPath ${exportIpaPath} \
-exportOptionsPlist ${exportOptionsPlistPath} \
-quiet || exit
if [ -e $exportIpaPath/$scheme_name.ipa ]; then
echo '/// ipa包已导出'
#open $exportIpaPath
#rm -r $tempBuild_path
else
echo '/// ipa包导出失败'
fi
echo '/// 打包ipa完成'
网友评论