build.sh 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. set -e
  2. FullExecPath=$PWD
  3. pushd `dirname $0` > /dev/null
  4. FullScriptPath=`pwd`
  5. popd > /dev/null
  6. arg1="$1"
  7. arg2="$2"
  8. arg3="$3"
  9. if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then
  10. echo ""
  11. echo "This script is for building the production version of Telegram Desktop."
  12. echo ""
  13. echo "For building custom versions please visit the build instructions page at:"
  14. echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
  15. exit
  16. fi
  17. Error () {
  18. cd $FullExecPath
  19. echo "$1"
  20. exit 1
  21. }
  22. if [ ! -f "$FullScriptPath/target" ]; then
  23. Error "Build target not found!"
  24. fi
  25. while IFS='' read -r line || [[ -n "$line" ]]; do
  26. BuildTarget="$line"
  27. done < "$FullScriptPath/target"
  28. while IFS='' read -r line || [[ -n "$line" ]]; do
  29. set $line
  30. eval $1="$2"
  31. done < "$FullScriptPath/version"
  32. VersionForPacker="$AppVersion"
  33. if [ "$AlphaVersion" != "0" ]; then
  34. AppVersion="$AlphaVersion"
  35. AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
  36. AlphaBetaParam="-alpha $AlphaVersion"
  37. AlphaKeyFile="talpha_${AppVersion}_key"
  38. elif [ "$BetaChannel" == "0" ]; then
  39. AppVersionStrFull="$AppVersionStr"
  40. AlphaBetaParam=''
  41. else
  42. AppVersionStrFull="$AppVersionStr.beta"
  43. AlphaBetaParam='-beta'
  44. fi
  45. echo ""
  46. HomePath="$FullScriptPath/.."
  47. if [ "$BuildTarget" == "linux" ]; then
  48. echo "Building version $AppVersionStrFull for Linux 64bit.."
  49. UpdateFile="tlinuxupd$AppVersion"
  50. SetupFile="tsetup.$AppVersionStrFull.tar.xz"
  51. ProjectPath="$HomePath/../out"
  52. ReleasePath="$ProjectPath/Release"
  53. BinaryName="Telegram"
  54. elif [ "$BuildTarget" == "mac" ] ; then
  55. if [ "$arg1" == "x86_64" ] || [ "$arg1" == "arm64" ]; then
  56. echo "Building version $AppVersionStrFull for macOS 10.13+ ($arg1).."
  57. MacArch="$arg1"
  58. if [ "$arg2" == "request_uuid" ] && [ "$arg3" != "" ]; then
  59. NotarizeRequestId="$arg3"
  60. fi
  61. else
  62. echo "Building version $AppVersionStrFull for macOS 10.13+.."
  63. if [ "$arg2" != "" ]; then
  64. if [ "$arg1" == "request_uuid_x86_64" ]; then
  65. NotarizeRequestIdAMD64="$arg2"
  66. elif [ "$arg1" == "request_uuid_arm64" ]; then
  67. NotarizeRequestIdARM64="$arg2"
  68. elif [ "$arg1" == "request_uuid" ]; then
  69. NotarizeRequestId="$arg2"
  70. fi
  71. fi
  72. fi
  73. if [ "$AC_USERNAME" == "" ]; then
  74. Error "AC_USERNAME not found!"
  75. fi
  76. UpdateFileAMD64="tmacupd$AppVersion"
  77. UpdateFileARM64="tarmacupd$AppVersion"
  78. if [ "$MacArch" == "arm64" ]; then
  79. UpdateFile="$UpdateFileARM64"
  80. elif [ "$MacArch" == "x86_64" ]; then
  81. UpdateFile="$UpdateFileAMD64"
  82. fi
  83. ProjectPath="$HomePath/../out"
  84. ReleasePath="$ProjectPath/Release"
  85. BinaryName="Telegram"
  86. if [ "$MacArch" != "" ]; then
  87. BundleName="$BinaryName.$MacArch.app"
  88. SetupFile="tsetup.$MacArch.$AppVersionStrFull.dmg"
  89. else
  90. BundleName="$BinaryName.app"
  91. SetupFile="tsetup.$AppVersionStrFull.dmg"
  92. fi
  93. elif [ "$BuildTarget" == "macstore" ]; then
  94. if [ "$AlphaVersion" != "0" ]; then
  95. Error "Can't build macstore alpha version!"
  96. fi
  97. echo "Building version $AppVersionStrFull for Mac App Store.."
  98. ProjectPath="$HomePath/../out"
  99. ReleasePath="$ProjectPath/Release"
  100. BinaryName="Telegram Lite"
  101. BundleName="$BinaryName.app"
  102. else
  103. Error "Invalid target!"
  104. fi
  105. if [ "$AlphaVersion" != "0" ]; then
  106. if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull" ]; then
  107. Error "Deploy folder for version $AppVersionStrFull already exists!"
  108. fi
  109. else
  110. if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr.alpha" ]; then
  111. Error "Deploy folder for version $AppVersionStr.alpha already exists!"
  112. fi
  113. if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr.beta" ]; then
  114. Error "Deploy folder for version $AppVersionStr.beta already exists!"
  115. fi
  116. if [ -d "$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStr" ]; then
  117. Error "Deploy folder for version $AppVersionStr already exists!"
  118. fi
  119. if [ -f "$ReleasePath/$UpdateFile" ]; then
  120. Error "Update file for version $AppVersion already exists!"
  121. fi
  122. fi
  123. DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull"
  124. if [ "$BuildTarget" == "linux" ]; then
  125. DropboxSymbolsPath="/media/psf/Dropbox/Telegram/symbols"
  126. if [ ! -d "$DropboxSymbolsPath" ]; then
  127. DropboxSymbolsPath="/mnt/c/Telegram/Dropbox/Telegram/symbols"
  128. if [ ! -d "$DropboxSymbolsPath" ]; then
  129. Error "Dropbox path not found!"
  130. fi
  131. fi
  132. BackupPath="/media/psf/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull/t$BuildTarget"
  133. if [ ! -d "/media/psf/backup/tdesktop" ]; then
  134. BackupPath="/mnt/c/Telegram/Projects/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull/t$BuildTarget"
  135. if [ ! -d "/mnt/c/Telegram/Projects/backup/tdesktop" ]; then
  136. Error "Backup folder not found!"
  137. fi
  138. fi
  139. ./build/docker/centos_env/run.sh /usr/src/tdesktop/Telegram/build/docker/build.sh
  140. echo "Copying from docker result folder."
  141. cp "$ReleasePath/root/$BinaryName" "$ReleasePath/$BinaryName"
  142. cp "$ReleasePath/root/Updater" "$ReleasePath/Updater"
  143. cp "$ReleasePath/root/Packer" "$ReleasePath/Packer"
  144. echo "Dumping debug symbols.."
  145. "$ReleasePath/dump_syms" "$ReleasePath/$BinaryName" > "$ReleasePath/$BinaryName.sym"
  146. echo "Done!"
  147. echo "Stripping the executable.."
  148. strip -s "$ReleasePath/$BinaryName"
  149. echo "Done!"
  150. echo "Preparing version $AppVersionStrFull, executing Packer.."
  151. cd "$ReleasePath"
  152. "./Packer" -path "$BinaryName" -path Updater -version $VersionForPacker $AlphaBetaParam
  153. echo "Packer done!"
  154. if [ "$AlphaVersion" != "0" ]; then
  155. if [ ! -f "$ReleasePath/$AlphaKeyFile" ]; then
  156. Error "Alpha version key file not found!"
  157. fi
  158. while IFS='' read -r line || [[ -n "$line" ]]; do
  159. AlphaSignature="$line"
  160. done < "$ReleasePath/$AlphaKeyFile"
  161. UpdateFile="${UpdateFile}_${AlphaSignature}"
  162. SetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
  163. fi
  164. SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.sym" | awk -F " " 'END {print $4}'`
  165. echo "Copying $BinaryName.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
  166. mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
  167. cp "$ReleasePath/$BinaryName.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/"
  168. echo "Done!"
  169. if [ ! -d "$ReleasePath/deploy" ]; then
  170. mkdir "$ReleasePath/deploy"
  171. fi
  172. if [ ! -d "$ReleasePath/deploy/$AppVersionStrMajor" ]; then
  173. mkdir "$ReleasePath/deploy/$AppVersionStrMajor"
  174. fi
  175. echo "Copying $BinaryName, Updater and $UpdateFile to deploy/$AppVersionStrMajor/$AppVersionStrFull..";
  176. mkdir "$DeployPath"
  177. mkdir "$DeployPath/$BinaryName"
  178. mv "$ReleasePath/$BinaryName" "$DeployPath/$BinaryName/"
  179. mv "$ReleasePath/Updater" "$DeployPath/$BinaryName/"
  180. mv "$ReleasePath/$UpdateFile" "$DeployPath/"
  181. if [ "$AlphaVersion" != "0" ]; then
  182. mv "$ReleasePath/$AlphaKeyFile" "$DeployPath/"
  183. fi
  184. cd "$DeployPath"
  185. tar -cJvf "$SetupFile" "$BinaryName/"
  186. mkdir -p $BackupPath
  187. cp "$SetupFile" "$BackupPath/"
  188. cp "$UpdateFile" "$BackupPath/"
  189. if [ "$AlphaVersion" != "0" ]; then
  190. cp -v "$AlphaKeyFile" "$BackupPath/"
  191. fi
  192. fi
  193. if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "macstore" ]; then
  194. DropboxSymbolsPath="$HOME/Dropbox/Telegram/symbols"
  195. if [ ! -d "$DropboxSymbolsPath" ]; then
  196. Error "Dropbox path not found!"
  197. fi
  198. BackupPath="$HOME/Projects/backup/tdesktop/$AppVersionStrMajor/$AppVersionStrFull"
  199. if [ ! -d "$HOME/Projects/backup/tdesktop" ]; then
  200. Error "Backup path not found!"
  201. fi
  202. if [ "$MacArch" != "" ]; then
  203. cd $ReleasePath
  204. echo "Preparing single $MacArch .app.."
  205. rm -rf $BundleName
  206. cp -R $BinaryName.app $BundleName
  207. lipo -thin $MacArch $BinaryName.app/Contents/MacOS/$BinaryName -output $BundleName/Contents/MacOS/$BinaryName
  208. lipo -thin $MacArch $BinaryName.app/Contents/Frameworks/Updater -output $BundleName/Contents/Frameworks/Updater
  209. lipo -thin $MacArch $BinaryName.app/Contents/Helpers/crashpad_handler -output $BundleName/Contents/Helpers/crashpad_handler
  210. echo "Done!"
  211. elif [ "$NotarizeRequestId" == "" ]; then
  212. if [ "$NotarizeRequestIdAMD64" == "" ] && [ "$NotarizeRequestIdARM64" == "" ]; then
  213. if [ -f "$ReleasePath/$BinaryName.app/Contents/Info.plist" ]; then
  214. rm "$ReleasePath/$BinaryName.app/Contents/Info.plist"
  215. fi
  216. if [ -f "$ProjectPath/Telegram/CMakeFiles/Telegram.dir/Info.plist" ]; then
  217. rm "$ProjectPath/Telegram/CMakeFiles/Telegram.dir/Info.plist"
  218. fi
  219. rm -rf "$ReleasePath/$BinaryName.app/Contents/_CodeSignature"
  220. rm -rf "$ReleasePath/Updater"
  221. ./configure.sh -D DESKTOP_APP_MAC_ARCH="arm64;x86_64"
  222. cd $ProjectPath
  223. cmake --build . --config Release --target Telegram
  224. fi
  225. if [ ! -d "$ReleasePath/$BinaryName.app" ]; then
  226. Error "$BinaryName.app not found!"
  227. fi
  228. cd $FullExecPath
  229. if [ "$BuildTarget" == "mac" ]; then
  230. if [ "$NotarizeRequestIdAMD64" == "" ]; then
  231. echo "Preparing single arm64 update.."
  232. ./$0 arm64 request_uuid $NotarizeRequestIdARM64
  233. fi
  234. echo "Preparing single x86_64 update.."
  235. ./$0 x86_64 request_uuid $NotarizeRequestIdAMD64
  236. echo "Done."
  237. fi
  238. cd $ReleasePath
  239. fi
  240. if [ "$NotarizeRequestId" == "" ]; then
  241. if [ "$BuildTarget" == "mac" ]; then
  242. if [ ! -f "$ReleasePath/$BundleName/Contents/Frameworks/Updater" ]; then
  243. Error "Updater not found!"
  244. fi
  245. if [ ! -f "$ReleasePath/$BundleName/Contents/Helpers/crashpad_handler" ]; then
  246. Error "crashpad_handler not found!"
  247. fi
  248. fi
  249. if [ "$BuildTarget" == "macstore" ]; then
  250. if [ ! -d "$ReleasePath/$BundleName/Contents/Frameworks/Breakpad.framework" ]; then
  251. Error "Breakpad.framework not found!"
  252. fi
  253. fi
  254. if [ "$MacArch" == "" ]; then
  255. echo "Dumping debug symbols x86_64 from universal.."
  256. "$HomePath/../../Libraries/breakpad/src/tools/mac/dump_syms/build/Release/dump_syms" "-a" "x86_64" "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" > "$ReleasePath/$BinaryName.x86_64.sym" 2>/dev/null
  257. echo "Done!"
  258. SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.x86_64.sym" | awk -F " " 'END {print $4}'`
  259. echo "Copying $BinaryName.x86_64.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
  260. mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
  261. cp "$ReleasePath/$BinaryName.x86_64.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/$BinaryName.sym"
  262. echo "Done!"
  263. echo "Dumping debug symbols arm64 from universal.."
  264. "$HomePath/../../Libraries/breakpad/src/tools/mac/dump_syms/build/Release/dump_syms" "-a" "arm64" "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName" > "$ReleasePath/$BinaryName.arm64.sym" 2>/dev/null
  265. echo "Done!"
  266. SymbolsHash=`head -n 1 "$ReleasePath/$BinaryName.arm64.sym" | awk -F " " 'END {print $4}'`
  267. echo "Copying $BinaryName.arm64.sym to $DropboxSymbolsPath/$BinaryName/$SymbolsHash"
  268. mkdir -p "$DropboxSymbolsPath/$BinaryName/$SymbolsHash"
  269. cp "$ReleasePath/$BinaryName.arm64.sym" "$DropboxSymbolsPath/$BinaryName/$SymbolsHash/$BinaryName.sym"
  270. echo "Done!"
  271. fi
  272. echo "Stripping the executable.."
  273. strip "$ReleasePath/$BundleName/Contents/MacOS/$BinaryName"
  274. if [ "$BuildTarget" == "mac" ]; then
  275. strip "$ReleasePath/$BundleName/Contents/Frameworks/Updater"
  276. strip "$ReleasePath/$BundleName/Contents/Helpers/crashpad_handler"
  277. fi
  278. echo "Done!"
  279. echo "Signing the application.."
  280. if [ "$BuildTarget" == "mac" ]; then
  281. codesign --force --deep --timestamp --options runtime --sign "Developer ID Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BundleName" --entitlements "$HomePath/Telegram/Telegram.entitlements"
  282. elif [ "$BuildTarget" == "macstore" ]; then
  283. codesign --force --timestamp --options runtime --sign "3rd Party Mac Developer Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BundleName/Contents/Frameworks/Breakpad.framework/Versions/A/Resources/breakpadUtilities.dylib" --entitlements "$HomePath/Telegram/Breakpad.entitlements"
  284. codesign --force --deep --timestamp --options runtime --sign "3rd Party Mac Developer Application: Telegram FZ-LLC (C67CF9S4VU)" "$ReleasePath/$BundleName" --entitlements "$HomePath/Telegram/Telegram Lite.entitlements"
  285. echo "Making an installer.."
  286. productbuild --sign "3rd Party Mac Developer Installer: Telegram FZ-LLC (C67CF9S4VU)" --component "$ReleasePath/$BundleName" /Applications "$ReleasePath/$BinaryName.pkg"
  287. fi
  288. echo "Done!"
  289. if [ ! -f "$ReleasePath/$BundleName/Contents/Resources/Icon.icns" ]; then
  290. Error "Icon.icns not found in Resources!"
  291. fi
  292. if [ ! -f "$ReleasePath/$BundleName/Contents/MacOS/$BinaryName" ]; then
  293. Error "$BinaryName not found in MacOS!"
  294. fi
  295. if [ ! -d "$ReleasePath/$BundleName/Contents/_CodeSignature" ]; then
  296. Error "$BinaryName signature not found!"
  297. fi
  298. if [ "$BuildTarget" == "macstore" ]; then
  299. if [ ! -f "$ReleasePath/$BinaryName.pkg" ]; then
  300. Error "$BinaryName.pkg not found!"
  301. fi
  302. fi
  303. fi
  304. if [ "$BuildTarget" == "mac" ]; then
  305. cd "$ReleasePath"
  306. if [ "$NotarizeRequestId" == "" ]; then
  307. if [ "$AlphaVersion" == "0" ]; then
  308. cp -f tsetup_template.dmg tsetup.temp.dmg
  309. TempDiskPath=`hdiutil attach -nobrowse -noautoopenrw -readwrite tsetup.temp.dmg | awk -F "\t" 'END {print $3}'`
  310. cp -R "./$BundleName" "$TempDiskPath/"
  311. bless --folder "$TempDiskPath/"
  312. hdiutil detach "$TempDiskPath"
  313. hdiutil convert tsetup.temp.dmg -format UDBZ -ov -o "$SetupFile"
  314. rm tsetup.temp.dmg
  315. fi
  316. fi
  317. if [ "$AlphaVersion" != "0" ]; then
  318. cd $ReleasePath
  319. "./Packer" -path "$BundleName" -target "$BuildTarget" -version $VersionForPacker $AlphaBetaParam -alphakey
  320. if [ ! -f "$AlphaKeyFile" ]; then
  321. Error "Alpha version key file not found!"
  322. fi
  323. while IFS='' read -r line || [[ -n "$line" ]]; do
  324. AlphaSignature="$line"
  325. done < "$ReleasePath/$AlphaKeyFile"
  326. UpdateFile="${UpdateFile}_${AlphaSignature}"
  327. UpdateFileAMD64="${UpdateFileAMD64}_${AlphaSignature}"
  328. UpdateFileARM64="${UpdateFileARM64}_${AlphaSignature}"
  329. if [ "$MacArch" != "" ]; then
  330. SetupFile="talpha${AlphaVersion}_${MacArch}_${AlphaSignature}.zip"
  331. else
  332. SetupFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
  333. fi
  334. if [ "$NotarizeRequestId" == "" ]; then
  335. rm -rf "$ReleasePath/AlphaTemp"
  336. mkdir "$ReleasePath/AlphaTemp"
  337. mkdir "$ReleasePath/AlphaTemp/$BinaryName"
  338. cp -r "$ReleasePath/$BundleName" "$ReleasePath/AlphaTemp/$BinaryName/"
  339. cd "$ReleasePath/AlphaTemp"
  340. zip -r "$SetupFile" "$BinaryName"
  341. mv "$SetupFile" "$ReleasePath/"
  342. cd "$ReleasePath"
  343. fi
  344. fi
  345. echo "Beginning notarization process."
  346. xcrun notarytool submit "$SetupFile" --keychain-profile "preston" --wait
  347. xcrun stapler staple "$ReleasePath/$BundleName"
  348. if [ "$MacArch" != "" ]; then
  349. rm "$ReleasePath/$SetupFile"
  350. echo "Setup file $SetupFile removed."
  351. elif [ "$AlphaVersion" != "0" ]; then
  352. rm -rf "$ReleasePath/AlphaTemp"
  353. mkdir "$ReleasePath/AlphaTemp"
  354. mkdir "$ReleasePath/AlphaTemp/$BinaryName"
  355. cp -r "$ReleasePath/$BinaryName.app" "$ReleasePath/AlphaTemp/$BinaryName/"
  356. cd "$ReleasePath/AlphaTemp"
  357. zip -r "$SetupFile" "$BinaryName"
  358. mv "$SetupFile" "$ReleasePath/"
  359. cd "$ReleasePath"
  360. echo "Alpha archive re-created."
  361. else
  362. xcrun stapler staple "$ReleasePath/$SetupFile"
  363. fi
  364. if [ "$MacArch" != "" ]; then
  365. UpdatePackPath="$ReleasePath/update_pack_${MacArch}"
  366. rm -rf "$UpdatePackPath"
  367. mkdir "$UpdatePackPath"
  368. mv "$ReleasePath/$BundleName" "$UpdatePackPath/$BinaryName.app"
  369. cp "$ReleasePath/Packer" "$UpdatePackPath/"
  370. cd "$UpdatePackPath"
  371. "./Packer" -path "$BinaryName.app" -target "$BuildTarget" -version $VersionForPacker -arch $MacArch $AlphaBetaParam
  372. echo "Packer done!"
  373. mv "$UpdateFile" "$ReleasePath/"
  374. cd "$ReleasePath"
  375. rm -rf "$UpdatePackPath"
  376. exit
  377. fi
  378. fi
  379. if [ ! -d "$ReleasePath/deploy" ]; then
  380. mkdir "$ReleasePath/deploy"
  381. fi
  382. if [ ! -d "$ReleasePath/deploy/$AppVersionStrMajor" ]; then
  383. mkdir "$ReleasePath/deploy/$AppVersionStrMajor"
  384. fi
  385. if [ "$BuildTarget" == "mac" ]; then
  386. echo "Copying $BinaryName.app, $UpdateFileAMD64 and $UpdateFileARM64 to deploy/$AppVersionStrMajor/$AppVersionStr..";
  387. mkdir "$DeployPath"
  388. mkdir "$DeployPath/$BinaryName"
  389. cp -r "$ReleasePath/$BinaryName.app" "$DeployPath/$BinaryName/"
  390. if [ "$AlphaVersion" != "0" ]; then
  391. mv "$ReleasePath/$AlphaKeyFile" "$DeployPath/"
  392. fi
  393. rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
  394. rm "$ReleasePath/$BinaryName.app/Contents/Frameworks/Updater"
  395. mv "$ReleasePath/$UpdateFileAMD64" "$DeployPath/"
  396. mv "$ReleasePath/$UpdateFileARM64" "$DeployPath/"
  397. mv "$ReleasePath/$SetupFile" "$DeployPath/"
  398. if [ "$BuildTarget" == "mac" ]; then
  399. mkdir -p "$BackupPath/tmac"
  400. cp "$DeployPath/$UpdateFileAMD64" "$BackupPath/tmac/"
  401. cp "$DeployPath/$UpdateFileARM64" "$BackupPath/tmac/"
  402. cp "$DeployPath/$SetupFile" "$BackupPath/tmac/"
  403. if [ "$AlphaVersion" != "0" ]; then
  404. cp -v "$DeployPath/$AlphaKeyFile" "$BackupPath/tmac/"
  405. fi
  406. fi
  407. elif [ "$BuildTarget" == "macstore" ]; then
  408. echo "Copying $BinaryName.app to deploy/$AppVersionStrMajor/$AppVersionStr..";
  409. mkdir "$DeployPath"
  410. cp -r "$ReleasePath/$BinaryName.app" "$DeployPath/"
  411. mv "$ReleasePath/$BinaryName.pkg" "$DeployPath/"
  412. rm "$ReleasePath/$BinaryName.app/Contents/MacOS/$BinaryName"
  413. fi
  414. fi
  415. echo "Version $AppVersionStrFull is ready!";
  416. echo -en "\007";
  417. sleep 1;
  418. echo -en "\007";
  419. sleep 1;
  420. echo -en "\007";