IOS-APP自動化打包上傳蒲公英Shell版__IOS

來源:互聯網
上載者:User
#!/usr/bin/env bash# name: adminecho "~~~~~~~~~~~~~~~~開始執行指令碼~~~~~~~~~~~~~~~~"#開始時間beginTime=`date +%s`DATE=`date '+%Y-%m-%d-%T'`#需要編譯的 targetNameTARGET_NAME="WheatMoneyManagement"#編譯模式 工程預設有 Debug ReleaseCONFIGURATION_TARGET=Release#編譯路徑BUILDPATH=/opt/demo/build/${TARGET_NAME}_${DATE}#archivePathARCHIVEPATH=${BUILDPATH}/${TARGET_NAME}.xcarchive#輸出的ipa目錄IPAPATH=/Users/admin/Desktop#匯出ipa 所需plistADHOCExportOptionsPlist=${ARCHIVEPATH}/Info.plistExportOptionsPlist=${ADHOCExportOptionsPlist}# 是否上傳蒲公英UPLOADPGYER=true# git項目分支號breach=v2.0.0git clone -b $breach 項目git地址echo "~~~~~~~~~~~~~~~~開始構建~~~~~~~~~~~~~~~~~~~"#開始構建xcodebuild archive -workspace ${TARGET_NAME}.xcworkspace \-scheme ${TARGET_NAME} \-archivePath ${ARCHIVEPATH} \-configuration ${CONFIGURATION_TARGET}echo "~~~~~~~~~~~~~~~~檢查是否構建成功~~~~~~~~~~~~~~~~~~~"# xcarchive 實際是一個檔案夾不是一個檔案所以使用 -d 判斷if [ -d "$ARCHIVEPATH" ]thenecho "構建成功......"elseecho "構建失敗......"rm -rf $BUILDPATHexit 1fiendTime=`date +%s`ArchiveTime="構建時間$[ endTime - beginTime ]秒"echo "~~~~~~~~~~~~~~~~匯出ipa~~~~~~~~~~~~~~~~~~~"beginTime=`date +%s`xcodebuild -exportArchive \-archivePath ${ARCHIVEPATH} \-exportOptionsPlist ${ExportOptionsPlist} \-exportPath ${IPAPATH}echo "~~~~~~~~~~~~~~~~檢查是否成功匯出ipa~~~~~~~~~~~~~~~~~~~"IPAPATH=${IPAPATH}/${TARGET_NAME}.ipaif [ -f "$IPAPATH" ]thenecho "匯出ipa成功......"elseecho "匯出ipa失敗......"# 結束時間endTime=`date +%s`echo "$ArchiveTime"echo "匯出ipa時間$[ endTime - beginTime ]秒"exit 1fiendTime=`date +%s`ExportTime="匯出ipa時間$[ endTime - beginTime ]秒"    # 上傳蒲公英if [ $UPLOADPGYER = true ]; then    echo "~~~~~~~~~~~~~~~~上傳ipa到蒲公英~~~~~~~~~~~~~~~~~~~"    curl -F "file=@$IPAPATH" \    -F "uKey=9c86dd6f*******d7d784e841d91" \    -F "_api_key=220fd5e840f******bdb80e2e80" \    -F "password=蒲公英密碼" \    https://www.pgyer.com/apiv1/app/upload    if [ $? = 0 ]    thenecho -e "\n"        echo "~~~~~~~~~~~~~~~~上傳蒲公英成功~~~~~~~~~~~~~~~~~~~"    elseecho -e "\n"        echo "~~~~~~~~~~~~~~~~上傳蒲公英失敗~~~~~~~~~~~~~~~~~~~"    fifiecho "~~~~~~~~~~~~~~~~配置資訊~~~~~~~~~~~~~~~~~~~"echo "開始執行指令碼時間: ${DATE}"echo "編譯模式: ${CONFIGURATION_TARGET}"echo "匯出ipa配置: ${ExportOptionsPlist}"echo "打包檔案路徑: ${ARCHIVEPATH}"echo "匯出ipa路徑: ${IPAPATH}"echo "$ArchiveTime"echo "$ExportTime"exit 1

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.