Jenkins iOS打包

project_path="${WORKSPACE}/tztAppV4/tztMobileApp_gssc.xcworkspace"
ipa_path=${WORKSPACE}
scheme_name="com.gszq.hundsun"
configuration="Release"
cur_date="$(date +%Y%m%d)"
cur_time="$(date +%H%M)"
ipa_name="国盛通[上架包][${cur_date}][${cur_time}]"

############设置版本号#############
version=${Version}
info_plist_path="${WORKSPACE}/tztAppV4/tztAppV4/Info.plist"
widget_info_plist_path="${WORKSPACE}/tztAppV4/GSTWidget/Info.plist"
tztSystemSetting_plist_path="${WORKSPACE}/tztClasses/tztResource/tzt.bundle/plist/tztSystermSetting.plist"
/usr/libexec/PlistBuddy -c "Set :SysFromVer $version" "$tztSystemSetting_plist_path"
/usr/libexec/PlistBuddy -c "Set :SystemVer $version" "$tztSystemSetting_plist_path"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $version" "$info_plist_path"
############设置build次数#############
build=${BUILD_NUMBER}
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $build" "$info_plist_path"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $build" "$widget_info_plist_path"

############设置tztappserver.strings#############
tztappserver_path="${WORKSPACE}/tztClasses/tztResource/tzt.bundle/tztappserver.strings"
sed -i "" '/tztserver_list/d' $tztappserver_path
echo '"tztserver_list_0" = "59.53.49.220:7779,240e:cf:8000:4:0101:0101:3305:20:7779&171.34.206.81:7779,2408:864C:0802:0:0101:0101:3305:20:7779&223.83.138.48:7779,2409:8738:c00:0:0101:0101:3305:20:7779&117.40.3.26:7779,240e:cd:801b:1000:0102:0101:3305:20:7779&171.34.206.81:7779,2408:864c:0c02:0:0102:0101:3305:20:7779&223.83.138.48:7779,2409:8738:0200:1:0102:0101:3305:20:7779&116.228.8.96:7779&116.128.210.161:7779&117.185.5.20:7779";' >> $tztappserver_path
echo '"tztserver_list_1" = "59.53.49.220:7778,240e:cf:8000:4:0101:0101:3305:50:7778&171.34.206.81:7778,2408:864C:0802:0:0101:0101:3305:50:7778&223.83.138.48:7778,2409:8738:c00:0:0101:0101:3305:50:7778&117.40.3.26:7778,240e:cd:801b:1000:0102:0101:3305:50:7778&171.34.206.81:7778,2408:864c:0c02:0:0102:0101:3305:50:7778&223.83.138.48:7778,2409:8738:0200:1:0102:0101:3305:50:7778&116.228.8.96:7778&116.128.210.161:7778&117.185.5.20:7778";' >> $tztappserver_path
echo '"tztserver_list_2" = "59.53.49.220:7777,240e:cf:8000:4:0101:0101:3305:110:7777&171.34.206.81:7777,2408:864C:0802:0:0101:0101:3305:110:7777&223.83.138.48:7777,2409:8738:c00:0:0101:0101:3305:110:7777&117.40.3.26:7777,240e:cd:801b:1000:0102:0101:3305:110:7777&171.34.206.81:7777,2408:864c:0c02:0:0102:0101:3305:110:7777&223.83.138.48:7777,2409:8738:0200:1:0102:0101:3305:110:7777&116.228.8.96:7777&116.128.210.161:7777&117.185.5.20:7777";' >> $tztappserver_path
echo '"tztserver_list_3" = "59.53.49.220:7777,240e:cf:8000:4:0101:0101:3305:110:7777&171.34.206.81:7777,2408:864C:0802:0:0101:0101:3305:110:7777&223.83.138.48:7777,2409:8738:c00:0:0101:0101:3305:110:7777&117.40.3.26:7777,240e:cd:801b:1000:0102:0101:3305:110:7777&171.34.206.81:7777,2408:864c:0c02:0:0102:0101:3305:110:7777&223.83.138.48:7777,2409:8738:0200:1:0102:0101:3305:110:7777&116.228.8.96:7777&116.128.210.161:7777&117.185.5.20:7777";' >> $tztappserver_path

############设置GTThirdURL.strings#############
tztThirdPartConfig_path="${WORKSPACE}/tztClasses/tztResource/tzt.bundle/GTThirdURL.strings"
sed -i "" '/gt_third_url_sidi_openaccount/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_shence_release/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_hs_onlineService/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_api_bigdata_host/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_hs_writOffAccount/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_yunji_host/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_sidi_mall_host/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_investment/d' $tztThirdPartConfig_path
sed -i "" '/gt_weixin_subscribe/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_jy_f10_bond_host/d' $tztThirdPartConfig_path
sed -i "" '/gt_userstock_host/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_hs_businessManagement/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_ths_suggestProvider/d' $tztThirdPartConfig_path
sed -i "" '/gt_third_url_hs_questtionnaireSurvey/d' $tztThirdPartConfig_path
sed -i "" '/gt_info_host/d' $tztThirdPartConfig_path
echo '"gt_third_url_sidi_openaccount" = "https://xykh.gszq.com/m/open/views/account/index.html?user_channel=1&sjtj=1&activities=1";' >> $tztThirdPartConfig_path
echo '"gt_third_url_shence_release" = "https://scdata.gszq.com:8106/sa?project=guoshengtong";' >> $tztThirdPartConfig_path
echo '"gt_third_url_hs_onlineService" = "https://cc.gszq.com:8077/im-client/guider_page/index.html";' >> $tztThirdPartConfig_path
echo '"gt_third_api_bigdata_host" = "https://bigdata.gszq.com:26780";' >> $tztThirdPartConfig_path
echo '"gt_third_url_hs_writOffAccount" = "https://oca.gszq.com/h5oca/";' >> $tztThirdPartConfig_path
echo '"gt_third_url_yunji_host" = "https://bigdata.gszq.com:9081";' >> $tztThirdPartConfig_path
echo '"gt_third_url_sidi_mall_host" = "https://mall.gszq.com/lcsm";' >> $tztThirdPartConfig_path
echo '"gt_third_investment" = "1";' >> $tztThirdPartConfig_path
echo '"gt_weixin_subscribe" = "http://action:10061/?fullscreen=1&&url=/hd/shell.html?url=https%3A%2F%2Fhd.gszq.com%2Flts%2Fkh-binding%3Fmobile%3D";' >> $tztThirdPartConfig_path
echo '"gt_third_url_jy_f10_bond_host" = "https://mp.gszq.com";' >> $tztThirdPartConfig_path
echo '"gt_userstock_host" = "https://mp.gszq.com/securities-info";' >> $tztThirdPartConfig_path
echo '"gt_third_url_hs_businessManagement" = "https://oca.gszq.com/h5obh/";' >> $tztThirdPartConfig_path
echo '"gt_third_url_ths_suggestProvider" = "http://znzc.gszq.com:8080/dist";' >> $tztThirdPartConfig_path
echo '"gt_third_url_hs_questtionnaireSurvey" = "https://cc.gszq.com:8077/im-client/questionnaire";' >> $tztThirdPartConfig_path
echo '"gt_info_host" = "https://mp.gszq.com";' >> $tztThirdPartConfig_path
#顶点推送
sed -i "" '/gt_third_url_APEX_PUSH_HOST/d' $tztThirdPartConfig_path
echo '"gt_third_url_APEX_PUSH_HOST" = "push.gszq.com";' >> $tztThirdPartConfig_path
sed -i "" '/gt_third_url_APEX_PUSH_PORT/d' $tztThirdPartConfig_path
echo '"gt_third_url_APEX_PUSH_PORT" = "8883";' >> $tztThirdPartConfig_path
#博睿
sed -i "" '/gt_third_url_bonree/d' $tztThirdPartConfig_path
echo '"gt_third_url_bonree" = "https://bonree.gszq.com/config";' >> $tztThirdPartConfig_path
sed -i "" '/gt_third_appid_bonree/d' $tztThirdPartConfig_path
echo '"gt_third_appid_bonree" = "e53c6721-401c-42fe-af43-851866bb4365";' >> $tztThirdPartConfig_path
#今日投资
sed -i "" '/gt_third_url_jrtz/d' $tztThirdPartConfig_path
echo '"gt_third_url_jrtz" = "https://lyzt.investoday.net/riskwarnweb/v1/minesweeper";' >> $tztThirdPartConfig_path
sed -i "" '/gt_third_url_jrtz_SecretId/d' $tztThirdPartConfig_path
echo '"gt_third_url_jrtz_SecretId" = "XXj6J0fquHmXICDGLBbw1SYj7WJCOY3G";' >> $tztThirdPartConfig_path
sed -i "" '/gt_third_url_jrtz_SecretKey/d' $tztThirdPartConfig_path
echo '"gt_third_url_jrtz_SecretKey" = "sOzSKSf0q4SSyv4SMNVr36Bi00UvUci2";' >> $tztThirdPartConfig_path
#恒生机构掌厅
sed -i "" '/gt_third_url_hs_businessManagement_organ/d' $tztThirdPartConfig_path
echo '"gt_third_url_hs_businessManagement_organ" = "https://oca.gszq.com/h5org/";' >> $tztThirdPartConfig_path
#手机号码一键登录
sed -i "" '/gt_third_quick_login_appid/d' $tztThirdPartConfig_path
echo '"gt_third_quick_login_appid" = "99166000000000051865";' >> $tztThirdPartConfig_path

sed -i "" '/gt_third_quick_login_appsecret/d' $tztThirdPartConfig_path
echo '"gt_third_quick_login_appsecret" = "770584ba1fb2eb86225915e1b5533553";' >> $tztThirdPartConfig_path

sed -i "" '/gt_third_quick_login_appidverify/d' $tztThirdPartConfig_path
echo '"gt_third_quick_login_appidverify" = "99166000000000055889";' >> $tztThirdPartConfig_path

sed -i "" '/gt_third_quick_login_appsecretverify/d' $tztThirdPartConfig_path
echo '"gt_third_quick_login_appsecretverify" = "bafc4aa548b8e62ceb7118dd60d93096";' >> $tztThirdPartConfig_path

#阿里云语音识别
sed -i "" '/aliyun_url/d' $tztThirdPartConfig_path
echo '"aliyun_url" = "ws://cc.gszq.com:8101/ws/v1";' >> $tztThirdPartConfig_path
#恒生IM
sed -i "" '/gt_third_url_hs_im/d' $tztThirdPartConfig_path
echo '"gt_third_url_hs_im" = "https://ygdim.gszq.com:8889/g/hswealth.imi/v/";' >> $tztThirdPartConfig_path


############# 开始解锁keychain ################
/usr/bin/security unlock-keychain -p '[email protected]' ~/Library/Keychains/login.keychain

cd ${WORKSPACE}/tztAppV4/
pod update --no-repo-update

############# 删除Xcode 的DerivedData ################
rm -rf /Users/geektest/Library/Developer/Xcode/DerivedData

################################## Function ##################################
echo "########### Clean Project ###########"
xcodebuild clean -workspace ${project_path} -scheme ${scheme_name} -configuration ${configuration}

echo "########### Archive Project ###########"
xcodebuild -toolchain "cn.ijiami.obf" archive -archivePath ${ipa_path}/${ipa_name} -workspace ${project_path} -scheme ${scheme_name} -configuration ${configuration} -UseModernBuildSystem=YES 

echo "########### Export Project ###########"
xcodebuild -exportArchive -archivePath ${ipa_path}/${ipa_name}.xcarchive -exportPath ${ipa_path} -exportOptionsPlist /Users/geektest/Desktop/shell/stockAppStore/AppStoreExportOptionsPlist.plist


#echo "########### Rename IPA ###########"
mv "${ipa_path}/${scheme_name}.ipa" "${ipa_path}/${ipa_name}.ipa"

#echo "##########压缩符号表#########"
cd ${ipa_path}
tar czf "xcarchive.tar.gz" "${ipa_path}/${ipa_name}.xcarchive/dSYMs/${scheme_name}.app.dSYM"

herui

一枚干着DevOps工作的职业命理师

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据