Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

build-ipa.sh 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/bin/bash
  2. set -e
  3. # Mandatory arguments with no default values provided:
  4. # PR_REPO_SLUG - the Github name of the repo to be merged into the origin/master
  5. # PR_BRANCH - the branch to be merged, if set to "master" no merge will happen
  6. # IPA_DEPLOY_LOCATION - the location understandable by the "scp" command
  7. # executed at the end of the script to deploy the output .ipa file
  8. # LIB_JITSI_MEET_PKG (optional) - the npm package for lib-jitsi-meet which will
  9. # be put in place of the current version in the package.json file.
  10. #
  11. # Other than that the script requires the following env variables to be set:
  12. #
  13. # DEPLOY_SSH_CERT_URL - the SSH private key used by the 'scp' command to deploy
  14. # the .ipa. It is expected to be encrypted with the $ENCRYPTION_PASSWORD.
  15. # ENCRYPTION_PASSWORD - the password used to decrypt certificate/key files used
  16. # in the script.
  17. # IOS_TEAM_ID - the team ID inserted into build-ipa-.plist.template file in
  18. # place of "YOUR_TEAM_ID".
  19. function echoAndExit1() {
  20. echo $1
  21. exit 1
  22. }
  23. if [ -z $PR_REPO_SLUG ]; then
  24. echoAndExit1 "No PR_REPO_SLUG defined"
  25. fi
  26. if [ -z $PR_BRANCH ]; then
  27. echoAndExit1 "No PR_BRANCH defined"
  28. fi
  29. if [ -z $IPA_DEPLOY_LOCATION ]; then
  30. echoAndExit1 "No IPA_DEPLOY_LOCATION defined"
  31. fi
  32. echo "PR_REPO_SLUG=${PR_REPO_SLUG} PR_BRANCH=${PR_BRANCH}"
  33. # do the merge and git log
  34. if [ $PR_BRANCH != "master" ]; then
  35. echo "Will merge ${PR_REPO_SLUG}/${PR_BRANCH} into master"
  36. git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
  37. git fetch origin master
  38. git checkout master
  39. git pull https://github.com/${PR_REPO_SLUG}.git $PR_BRANCH --no-edit
  40. fi
  41. # Link this lib-jitsi-meet checkout in jitsi-meet through the package.json
  42. if [ ! -z ${LIB_JITSI_MEET_PKG} ];
  43. then
  44. echo "Adjusting lib-jitsi-meet package in package.json to ${LIB_JITSI_MEET_PKG}"
  45. # escape for the sed
  46. LIB_JITSI_MEET_PKG=$(echo $LIB_JITSI_MEET_PKG | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g')
  47. sed -i.bak -e "s/\"lib-jitsi-meet.*/\"lib-jitsi-meet\"\: \"${LIB_JITSI_MEET_PKG}\",/g" package.json
  48. echo "Package.json lib-jitsi-meet line:"
  49. grep lib-jitsi-meet package.json
  50. else
  51. echo "LIB_JITSI_MEET_PKG var not set - will not modify the package.json"
  52. fi
  53. git log -20 --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'
  54. # certificates
  55. CERT_DIR="ios/ci/certs"
  56. mkdir -p $CERT_DIR
  57. curl -L -o ${CERT_DIR}/id_rsa.enc ${DEPLOY_SSH_CERT_URL}
  58. openssl aes-256-cbc -k "$ENCRYPTION_PASSWORD" -in ${CERT_DIR}/id_rsa.enc -d -a -out ${CERT_DIR}/id_rsa
  59. chmod 0600 ${CERT_DIR}/id_rsa
  60. ssh-add ${CERT_DIR}/id_rsa
  61. npm install
  62. # Ever since the Apple Watch app has been added the bitcode for WebRTC needs to be downloaded in order to build successfully
  63. ./node_modules/react-native-webrtc/tools/downloadBitcode.sh
  64. cd ios
  65. pod install --repo-update --no-ansi
  66. cd ..
  67. mkdir -p /tmp/jitsi-meet/
  68. xcodebuild archive -quiet -workspace ios/jitsi-meet.xcworkspace -scheme jitsi-meet -configuration Release -archivePath /tmp/jitsi-meet/jitsi-meet.xcarchive
  69. sed -e "s/YOUR_TEAM_ID/${IOS_TEAM_ID}/g" ios/ci/build-ipa.plist.template > ios/ci/build-ipa.plist
  70. IPA_EXPORT_DIR=/tmp/jitsi-meet/jitsi-meet-ipa
  71. xcodebuild -quiet -exportArchive -archivePath /tmp/jitsi-meet/jitsi-meet.xcarchive -exportPath $IPA_EXPORT_DIR -exportOptionsPlist ios/ci/build-ipa.plist
  72. echo "Will try deploy the .ipa to: ${IPA_DEPLOY_LOCATION}"
  73. if [ ! -z ${SCP_PROXY_HOST} ];
  74. then
  75. scp -o ProxyCommand="ssh -t -A -l %r ${SCP_PROXY_HOST} -o \"StrictHostKeyChecking no\" -o \"BatchMode yes\" -W %h:%p" -o StrictHostKeyChecking=no -o LogLevel=DEBUG "${IPA_EXPORT_DIR}/jitsi-meet.ipa" "${IPA_DEPLOY_LOCATION}"
  76. else
  77. scp -o StrictHostKeyChecking=no -o LogLevel=DEBUG "${IPA_EXPORT_DIR}/jitsi-meet.ipa" "${IPA_DEPLOY_LOCATION}"
  78. fi
  79. rm -r /tmp/jitsi-meet/
  80. rm -r $CERT_DIR