







# 工程名ENV="测试环境"FILE="profile_ios_kpl_student"APP_NAME="SmartPiano"# target名TARGET_NAME="KPL"# workspace名WORK_SPACE="/Users/hhb/.jenkins/workspace/aipiano-ios/SmartPiano.xcworkspace"SCRIPT_PATH="/Users/hhb/PycharmProjects/AutoArchive"# info.plist路径project_infoplist_path="./${APP_NAME}/InfoDev.plist"ExportOptionsPlist="${SCRIPT_PATH}/EnterpriseExportOptionsPlist_kpl.plist"/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $APP_VERSION" "${project_infoplist_path}"bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" "${project_infoplist_path}")chmod 777 ${SCRIPT_PATH}/modify_build_number.sh${SCRIPT_PATH}/modify_build_number.sh "${SCRIPT_PATH}/json/ios/${PROJECT_NAME}" ${project_infoplist_path}bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" "${project_infoplist_path}")#bundleShortVersion=$(xcodebuild -workspace ${WORK_SPACE} -scheme ${TARGET_NAME} -showBuildSettings | grep MARKETING_VERSION | tr -d 'MARKETING_VERSION =')#bundleVersion=$(xcodebuild -project ${WORK_SPACE} -scheme ${TARGET_NAME} -showBuildSettings | grep CURRENT_PROJECT_VERSION | tr -d 'CURRENT_PROJECT_VERSION =')DATE="$(date +%Y%m%d%H%M)"# IPA路径IPAPATH="${TARGET_NAME}_V${bundleShortVersion}_Build${bundleVersion}_${DATE}"# IPA包名IPANAME="${TARGET_NAME}_V${bundleShortVersion}_Build${bundleVersion}_${DATE}.ipa"# xcarchiveXCARCHIVE="${TARGET_NAME}_V${bundleShortVersion}_Build${bundleVersion}_${DATE}.xcarchive"# 蒲公英用户keyUSER_KEY="b0b96**********e1976"# 蒲公英apiKeyAPI_KEY="219de**************e7b1bf"WebHook="https://oapi.dingtalk.com/robot/send?access_token=6790**************264410d3389c8b1"# 蒲公英用户key 测试#USER_KEY="3f835*************e4f3"# 蒲公英apiKey#API_KEY="19e98***************8777e"#WebHook="https://oapi.dingtalk.com/robot/send?access_token=a74698cab0*********************fd3c2d357db2f6e156a"# 打包${SCRIPT_PATH}/HrtBuildIpa.sh "${WORK_SPACE}" "${TARGET_NAME}" "${XCARCHIVE}" "${IPAPATH}" "${IPANAME}" "${ExportOptionsPlist}"result=`find ./build/${IPAPATH} -name '*.ipa'`mv ${result} "./build/${IPAPATH}/${IPANAME}"#mv "./build/${IPAPATH}/${TARGET_NAME}.ipa" "./build/${IPAPATH}/${IPANAME}"key="app/iOS"/${PROJECT_NAME}/${ENV}/${IPAPATH}/${IPANAME}filename="./build/${IPAPATH}/${IPANAME}"#上传osspython3 ${SCRIPT_PATH}/oss_upload.py --key "${key}" --filename "${filename}"OSS_PATH="oss://dev-kpl/app/iOS"/${PROJECT_NAME}# 上传到蒲公英${SCRIPT_PATH}/HrtPgyerUpload.sh "./build/${IPAPATH}/${IPANAME}" "${OSS_PATH}" "${USER_KEY}" "${API_KEY}" "${PACKAGERESUME}" "${ENV}" "${FILE}"#发送钉钉python3 ${SCRIPT_PATH}/send_dingding.py --webhook ${WebHook} --file ${FILE} --job $JOB_NAME