1.添加源码仓库地址
2.设置打包的分支
3.构建环境 勾选Restore OS X keychains after build process as defined in global configuration
4.添加执行脚本
例如:cd $WORKSPACE/
BUILD_DATE=`date +%y%m%d%H%M%S`
echo ${BUILD_DATE}
ENV_CODE=4
PCH_FILE=$WORKSPACE/OnMobile/OnMobile-Prefix.pch
sed -i ” “s/.*env_code.*/#define ENV_CODE $ENV_CODE/g” $PCH_FILE
sed -i ” “s/.*build_date.*/#define BUILD_ID \@\”$BUILD_DATE\”/g” $PCH_FILE
更新CocoaPod相关脚本
cd $WORKSPACE
export LANG=UTF-8
pod update –verbose –no-repo-update
5.设置Xcode
Target
.ipa filename pattern OnMobile_V${VERSION}_Distribution
Output directory $WORKSPACE
勾选Sign IPA at build time 设置keychain的path和密码
编译脚本
##################################################################################
cd $WORKSPACE
IPA_FILE=`basename *.ipa`
echo ${IPA_FILE}
VERSION=`echo $IPA_FILE | cut -d”_” -f2`
echo ${VERSION}
COMMIT_ID=`git rev-list HEAD -n 1 | cut -c 1-8`
echo ${COMMIT_ID}
DATE_TIME=`date +%y%m%d%H%M%S`
echo ${DATE_TIME}
mv *.ipa OnMobile_${VERSION}_Distribution_B${COMMIT_ID}_${DATE_TIME}.ipa
mv *dSYM.zip OnMobile_${VERSION}_Distribution_B${COMMIT_ID}_${DATE_TIME}_dSYM.zip
6.设置编译完后的操作,比如上传七牛、SCP文件、发邮件等