deploy-phpdoc-branch.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then
  3. echo "Skipping phpDoc deployment because this is not on the required runtime"
  4. exit
  5. fi
  6. if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then
  7. echo "Skipping phpDoc deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy"
  8. exit
  9. fi
  10. if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  11. echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy"
  12. exit
  13. fi
  14. PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
  15. PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
  16. PHPDOC_CACHE_DIR="$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache"
  17. PHPDOC_TARGET_DIR="$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID"
  18. # clone repo
  19. echo "Cloning repo..."
  20. git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$PHPDOC_GIT_DIR"
  21. [ $? -eq 0 ] || exit 1
  22. cd "$PHPDOC_GIT_DIR"
  23. echo
  24. # generate phpDocs
  25. generate-phpdoc.sh \
  26. "$TRAVIS_BUILD_DIR/.phpdoc.xml" \
  27. "$PHPDOC_CACHE_DIR" "$PHPDOC_TARGET_DIR" \
  28. "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)"
  29. [ $? -eq 0 ] || exit 1
  30. # deploy phpDocs
  31. deploy-phpdoc.sh \
  32. "Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \
  33. "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT"
  34. [ $? -eq 0 ] || exit 1