mac_store_upload.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. set -e
  2. FullExecPath=$PWD
  3. pushd `dirname $0` > /dev/null
  4. FullScriptPath=`pwd`
  5. popd > /dev/null
  6. if [ ! -d "$FullScriptPath/../../../DesktopPrivate" ]; then
  7. echo ""
  8. echo "This script is for building the production version of Telegram Desktop."
  9. echo ""
  10. echo "For building custom versions please visit the build instructions page at:"
  11. echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
  12. exit
  13. fi
  14. Error () {
  15. cd $FullExecPath
  16. echo "$1"
  17. exit 1
  18. }
  19. if [ ! -f "$FullScriptPath/target" ]; then
  20. Error "Build target not found!"
  21. fi
  22. while IFS='' read -r line || [[ -n "$line" ]]; do
  23. BuildTarget="$line"
  24. done < "$FullScriptPath/target"
  25. while IFS='' read -r line || [[ -n "$line" ]]; do
  26. set $line
  27. eval $1="$2"
  28. done < "$FullScriptPath/version"
  29. VersionForPacker="$AppVersion"
  30. if [ "$AlphaVersion" != "0" ]; then
  31. AppVersion="$AlphaVersion"
  32. AppVersionStrFull="${AppVersionStr}_${AlphaVersion}"
  33. AlphaBetaParam="-alpha $AlphaVersion"
  34. AlphaKeyFile="talpha_${AppVersion}_key"
  35. elif [ "$BetaChannel" == "0" ]; then
  36. AppVersionStrFull="$AppVersionStr"
  37. AlphaBetaParam=''
  38. else
  39. AppVersionStrFull="$AppVersionStr.beta"
  40. AlphaBetaParam='-beta'
  41. fi
  42. echo ""
  43. HomePath="$FullScriptPath/.."
  44. if [ "$BuildTarget" != "macstore" ]; then
  45. Error "Invalid target!"
  46. fi
  47. if [ "$AlphaVersion" != "0" ]; then
  48. Error "Can't upload macstore alpha version!"
  49. fi
  50. echo "Uploading version $AppVersionStrFull to Mac App Store.."
  51. ProjectPath="$HomePath/../out"
  52. ReleasePath="$ProjectPath/Release"
  53. BinaryName="Telegram Lite"
  54. DeployPath="$ReleasePath/deploy/$AppVersionStrMajor/$AppVersionStrFull"
  55. PackageFile="$DeployPath/$BinaryName.pkg"
  56. set +e
  57. xcrun altool --upload-app --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" -t macOS -f "$PackageFile"
  58. set -e
  59. echo -en "\007";
  60. sleep 1;
  61. echo -en "\007";
  62. sleep 1;
  63. echo -en "\007";