.travis_shell_after_success.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. echo "--DEBUG--"
  3. echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
  4. echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
  5. echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
  6. if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/Common" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then
  7. echo -e "Publishing PHPDoc...\n"
  8. cp -R build/docs $HOME/docs-latest
  9. cp -R build/coverage $HOME/coverage-latest
  10. cd $HOME
  11. git config --global user.email "travis@travis-ci.org"
  12. git config --global user.name "travis-ci"
  13. git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/Common gh-pages > /dev/null
  14. cd gh-pages
  15. echo "--DEBUG : Suppression"
  16. git rm -rf ./docs/$TRAVIS_BRANCH
  17. echo "--DEBUG : Dossier"
  18. mkdir -p docs/$TRAVIS_BRANCH
  19. mkdir -p coverage/$TRAVIS_BRANCH
  20. echo "--DEBUG : Copie"
  21. cp -Rf $HOME/docs-latest/* ./docs/$TRAVIS_BRANCH/
  22. cp -Rf $HOME/coverage-latest/* ./coverage/$TRAVIS_BRANCH/
  23. echo "--DEBUG : Git"
  24. git add -f .
  25. git commit -m "PHPDocumentor (Travis Build: $TRAVIS_BUILD_NUMBER - Branch: $TRAVIS_BRANCH)"
  26. git push -fq origin gh-pages > /dev/null
  27. echo -e "Published PHPDoc to gh-pages.\n"
  28. fi