deploy.sh 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. ARG_DEFS=(
  3. #"--version-name=(.*)"
  4. )
  5. echo "##### "
  6. echo "##### docs/deploy.sh"
  7. echo "#####"
  8. function init {
  9. cd ..
  10. SITE_PATH=$(readJsonProp "config.json" "sitePath")
  11. SITE_DIR=$SITE_PATH
  12. DOCS_DEST=$(readJsonProp "config.json" "docsDest")
  13. }
  14. function run {
  15. cd ..
  16. VERSION=$(readJsonProp "package.json" "version")
  17. # process new docs
  18. if [ -d "$DOCS_DEST" ]; then
  19. rm -R $DOCS_DEST
  20. fi
  21. ./node_modules/.bin/gulp docs
  22. # CD in to the site dir to commit updated docs
  23. cd $SITE_DIR
  24. CHANGES=$(git status --porcelain)
  25. # if no changes, don't commit
  26. if [[ "$CHANGES" == "" ]]; then
  27. echo "-- No changes detected for the following commit, docs not updated."
  28. echo "https://github.com/ionic-team/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
  29. else
  30. git config --global user.email "hi@ionicframework.com"
  31. git config --global user.name "Ionitron"
  32. git add -A
  33. git commit -am "Automated build of ionic-storage v$VERSION ionic-team/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
  34. # in case a different commit was pushed to ionic-site during doc/demo gen,
  35. # try to rebase around it before pushing
  36. git fetch
  37. git rebase
  38. git push origin master
  39. echo "-- Updated docs for $VERSION_NAME succesfully!"
  40. fi
  41. }
  42. source $(dirname $0)/../utils.sh.inc