deploy.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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=$IONIC_DIR/$SITE_PATH
  12. DOCS_DEST=$(readJsonProp "config.json" "docsDest")
  13. }
  14. function run {
  15. cd ..
  16. VERSION=$(readJsonProp "package.json" "version")
  17. # download and copy over API Demos
  18. ./node_modules/.bin/gulp demos.download
  19. ./node_modules/.bin/gulp docs.demos --production=true
  20. # if release, copy old version to seperate folder and blow out docs root api
  21. if $IS_RELEASE; then
  22. echo "BUILDING RELEASE DOCS"
  23. if [ -d "$DOCS_DEST/api" ]; then
  24. rm -R $DOCS_DEST/api
  25. fi
  26. if [ -d "$DOCS_DEST/nightly/api" ]; then
  27. rm -R $DOCS_DEST/nightly/api
  28. fi
  29. ./node_modules/.bin/gulp docs.dgeni --doc-version="$VERSION_NAME" --initial-build true
  30. ./node_modules/.bin/gulp docs.dgeni --doc-version="$VERSION_NAME"
  31. ./node_modules/.bin/gulp docs.dgeni --doc-version="nightly"
  32. ./node_modules/.bin/gulp docs.homepageVersionUpdate
  33. else
  34. if [ -d "$DOCS_DEST/nightly/api" ]; then
  35. rm -R $DOCS_DEST/nightly/api
  36. fi
  37. ./node_modules/.bin/gulp docs.dgeni --doc-version="$VERSION_NAME"
  38. fi
  39. # compile sass vars json for ionic-site docs
  40. ./node_modules/.bin/gulp docs.sassVariables
  41. cp tmp/sass.json $DOCS_DEST/theming/overriding-ionic-variables/
  42. # CD in to the site dir to commit updated docs
  43. cd $SITE_DIR
  44. CHANGES=$(git status --porcelain)
  45. # if no changes, don't commit
  46. if [[ "$CHANGES" == "" ]]; then
  47. echo "-- No changes detected for the following commit, docs not updated."
  48. echo "https://github.com/ionic-team/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
  49. else
  50. git add -A
  51. git commit -am "Automated build of ionic v$VERSION ionic-team/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
  52. # in case a different commit was pushed to ionic-site during doc/demo gen,
  53. # try to rebase around it before pushing
  54. git fetch
  55. git rebase
  56. git push origin master
  57. echo "-- Updated docs for $VERSION_NAME succesfully!"
  58. fi
  59. }
  60. source $(dirname $0)/../utils.sh.inc