deploy.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. #
  3. # Copyright (c) 2015 Marcus Rohrmoser http://mro.name/me. All rights reserved.
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. if [ ! -f "$1" ] ; then
  19. echo "File not found: '$1'" 1>&2
  20. exit 1
  21. fi
  22. app=ShaarliOS
  23. host=simply
  24. base="/var/www/lighttpd/drop.mro.name/public_html/dev/$app"
  25. tmp="/tmp/deploy.Info.plist"
  26. # extract CFBundleVersion from Info.plist:
  27. unzip -p "$1" "Payload/${app}.app/Info.plist" > "$tmp"
  28. if [ $? -ne 0 ] ; then
  29. echo "Unzip issue: unzip -p \"$1\" \"Payload/${app}.app/Info.plist\" > \"$tmp\"" 1>&2
  30. exit 2
  31. fi
  32. version=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$tmp")
  33. gitsha=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleGitSHA' "$tmp" 2>/dev/null)
  34. [ "" = "$gitsha" ] || { version="${version}+${gitsha}"; }
  35. # prepare dir and upload
  36. dst="${base}/deploy/v${version}/Debug/"
  37. ssh "${host}" "mkdir -p '${dst}' && chmod a+rwx '${dst}' && rm '${dst}'*"
  38. rsync --progress "$1" "${host}:${dst}/${app}.ipa"
  39. ssh "${host}" "ls -l '${dst}'"
  40. say -v Fiona "${app} version ${version} deployed, now comes doxygen docs upload"
  41. cd "$(dirname "$0")"
  42. sh doxygen.sh && rsync --progress --delete -avPz ../build/doxygen/ "${host}:${base}/docs/v${version}"
  43. open "http://drop.mro.name/dev/${app}/docs/v${version}/"
  44. say -v Fiona "all done."