cmd 903 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. pushd $(dirname "${0}") > /dev/null
  3. DIR=$(pwd -L)
  4. popd > /dev/null
  5. ACTION=$1
  6. build() {
  7. git add .
  8. git commit -m 'Gitbook Auto Published'
  9. git push origin master
  10. git push coding master
  11. node_modules/.bin/gitbook build
  12. cd _book
  13. git add .
  14. git commit -m "Gitbook Auto Deployed"
  15. git push -f coding master:coding-pages
  16. git push -f origin master:gh-pages
  17. }
  18. clean() {
  19. git add .
  20. git commit -m 'Gitbook Auto Published'
  21. git push origin master
  22. git push coding master
  23. rm -rf _book
  24. node_modules/.bin/gitbook build
  25. cd _book
  26. git init
  27. git add .
  28. git commit -m "Gitbook Auto Deployed"
  29. git remote add origin git@github.com:js-cool/leader.js.cool.git
  30. git remote add coding git@git.coding.net:willin/leader.js.cool.git
  31. git push -f coding master:coding-pages
  32. git push -f origin master:gh-pages
  33. }
  34. case "$ACTION" in
  35. clean)
  36. clean
  37. ;;
  38. *)
  39. build
  40. ;;
  41. esac