deploy.sh 635 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # https://mro.name/geohash
  3. #
  4. cd "$(dirname "${0}")" || exit 1
  5. make clean
  6. make || exit 1
  7. readonly name="geohash"
  8. readonly ver="0.1"
  9. readonly src="_build/default/bin/${name}.exe"
  10. git_sha="$(sed -En '/git_sha/s/^.+"([0-9a-f]+)"/\1/gp' < bin/version.ml)"
  11. dst="${name}-v${ver}+${git_sha}-$(uname -s)-$(uname -m)"
  12. readonly git_sha dst
  13. chmod u+w "${src}"
  14. strip "${src}"
  15. file "${src}"
  16. readonly dir="/var/www/vhosts/dev.mro.name/pages/${name}"
  17. ssh c1 mkdir -p "${dir}" \
  18. && rsync -avPz "${src}" c1:"${dir}/${dst}" \
  19. && ssh c1 ls -Al "${dir}/${dst}" \
  20. && exit 0
  21. echo rsync -avPz "$(pwd)/${src}" c1:"${dir}/${dst}"
  22. exit 1