"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-6316/ios/travis-ci/build-ipa.sh" (5 Jul 2022, 5176 Bytes) of package /linux/misc/jitsi-meet-6316.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/bin/bash
2 set -e
3
4 # The script is based on tutorial written by Antonis Tsakiridis published at:
5 # https://medium.com/@atsakiridis/continuous-deployment-for-ios-using-travis-ci-55dcea342d9
6 #
7 # It is intended to be executed through the Travis CI REST API call, as it
8 # requires few arguments which are mandatory with no default values provided:
9 # PR_REPO_SLUG - the Github name of the repo to be merged into the origin/master
10 # PR_BRANCH - the branch to be merged, if set to "master" no merge will happen
11 # IPA_DEPLOY_LOCATION - the location understandable by the "scp" command
12 # executed at the end of the script to deploy the output .ipa file
13 # LIB_JITSI_MEET_PKG (optional) - the npm package for lib-jitsi-meet which will
14 # be put in place of the current version in the package.json file.
15 #
16 # Other than that the script requires the following env variables to be set
17 # (reading the tutorial mentioned above will help in understanding the
18 # variables):
19 #
20 # APPLE_CERT_URL - the URL pointing to Apple certificate (set to
21 # http://developer.apple.com/certificationauthority/AppleWWDRCA.cer by default)
22 # DEPLOY_SSH_CERT_URL - the SSH private key used by the 'scp' command to deploy
23 # the .ipa. It is expected to be encrypted with the $ENCRYPTION_PASSWORD.
24 # ENCRYPTION_PASSWORD - the password used to decrypt certificate/key files used
25 # in the script.
26 # IOS_DEV_CERT_KEY_URL - URL pointing to provisioning profile certificate key
27 # file (development-key.p12.enc from the tutorial) encrypted with the
28 # $ENCRYPTION_PASSWORD.
29 # IOS_DEV_CERT_URL - URL pointing to provisioning profile certificate file
30 # (development-cert.cer.enc from the tutorial) encrypted with the
31 # $ENCRYPTION_PASSWORD.
32 # IOS_DEV_PROV_PROFILE_URL - URL pointing to provisioning profile file
33 # (profile-development-olympus.mobileprovision.enc from the tutorial) encrypted
34 # with the $ENCRYPTION_PASSWORD.
35 # IOS_SIGNING_CERT_PASSWORD - the password to the provisioning profile
36 # certificate key (used to open development-key.p12 from the tutorial).
37 # IOS_TEAM_ID - the team ID inserted into build-ipa-.plist.template file in
38 # place of "YOUR_TEAM_ID".
39
40
41 # Travis will not print the last echo if there's no sleep 1
42 function echoSleepAndExit1() {
43 echo $1
44 sleep 1
45 exit 1
46 }
47
48 echo "TRAVIS_BRANCH=${TRAVIS_BRANCH}"
49 echo "TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG}"
50
51 if [ -z $PR_REPO_SLUG ]; then
52 echoSleepAndExit1 "No PR_REPO_SLUG defined"
53 fi
54 if [ -z $PR_BRANCH ]; then
55 echoSleepAndExit1 "No PR_BRANCH defined"
56 fi
57 if [ -z $IPA_DEPLOY_LOCATION ]; then
58 echoSleepAndExit1 "No IPA_DEPLOY_LOCATION defined"
59 fi
60
61 echo "PR_REPO_SLUG=${PR_REPO_SLUG} PR_BRANCH=${PR_BRANCH}"
62
63 # do the merge and git log
64
65 if [ $PR_BRANCH != "master" ]; then
66 echo "Will merge ${PR_REPO_SLUG}/${PR_BRANCH} into master"
67 git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
68 git fetch origin master
69 git checkout master
70 git pull https://github.com/${PR_REPO_SLUG}.git $PR_BRANCH --no-edit
71 fi
72
73 # Link this lib-jitsi-meet checkout in jitsi-meet through the package.json
74 if [ ! -z ${LIB_JITSI_MEET_PKG} ];
75 then
76 echo "Adjusting lib-jitsi-meet package in package.json to ${LIB_JITSI_MEET_PKG}"
77 # escape for the sed
78 LIB_JITSI_MEET_PKG=$(echo $LIB_JITSI_MEET_PKG | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g')
79 sed -i.bak -e "s/\"lib-jitsi-meet.*/\"lib-jitsi-meet\"\: \"${LIB_JITSI_MEET_PKG}\",/g" package.json
80 echo "Package.json lib-jitsi-meet line:"
81 grep lib-jitsi-meet package.json
82 else
83 echo "LIB_JITSI_MEET_PKG var not set - will not modify the package.json"
84 fi
85
86 git log -20 --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'
87
88 #certificates
89 CERT_DIR="ios/travis-ci/certs"
90
91 mkdir -p $CERT_DIR
92
93 ./ios/ci/setup-certificates.sh $CERT_DIR
94
95 curl -L -o ${CERT_DIR}/id_rsa.enc ${DEPLOY_SSH_CERT_URL}
96 openssl aes-256-cbc -k "$ENCRYPTION_PASSWORD" -in ${CERT_DIR}/id_rsa.enc -d -a -out ${CERT_DIR}/id_rsa
97 chmod 0600 ${CERT_DIR}/id_rsa
98 ssh-add ${CERT_DIR}/id_rsa
99
100 npm install
101
102 # Ever since the Apple Watch app has been added the bitcode for WebRTC needs to be downloaded in order to build successfully
103 ./node_modules/react-native-webrtc/tools/downloadBitcode.sh
104
105 cd ios
106 pod install --repo-update --no-ansi
107 cd ..
108
109 mkdir -p /tmp/jitsi-meet/
110
111 xcodebuild archive -quiet -workspace ios/jitsi-meet.xcworkspace -scheme jitsi-meet -configuration Release -archivePath /tmp/jitsi-meet/jitsi-meet.xcarchive
112
113 sed -e "s/YOUR_TEAM_ID/${IOS_TEAM_ID}/g" ios/ci/build-ipa.plist.template > ios/ci/build-ipa.plist
114
115 IPA_EXPORT_DIR=/tmp/jitsi-meet/jitsi-meet-ipa
116
117 xcodebuild -quiet -exportArchive -archivePath /tmp/jitsi-meet/jitsi-meet.xcarchive -exportPath $IPA_EXPORT_DIR -exportOptionsPlist ios/ci/build-ipa.plist
118
119 echo "Will try deploy the .ipa to: ${IPA_DEPLOY_LOCATION}"
120
121 if [ ! -z ${SCP_PROXY_HOST} ];
122 then
123 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}"
124 else
125 scp -o StrictHostKeyChecking=no -o LogLevel=DEBUG "${IPA_EXPORT_DIR}/jitsi-meet.ipa" "${IPA_DEPLOY_LOCATION}"
126 fi
127