2015-11-25 23:29:14 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then
|
|
|
|
echo "Skipping phpDoc deployment because this is not on the required runtime"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then
|
2015-11-26 01:38:29 +00:00
|
|
|
echo "Skipping phpDoc deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy"
|
2015-11-25 23:29:14 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2015-11-26 03:06:34 +00:00
|
|
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
|
|
|
echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy"
|
2015-11-25 23:29:14 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2015-11-26 01:15:34 +00:00
|
|
|
PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
|
2015-11-30 13:53:10 +00:00
|
|
|
PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
|
2015-11-25 23:29:14 +00:00
|
|
|
|
2015-11-30 13:53:10 +00:00
|
|
|
# clone repo
|
|
|
|
echo "Cloning repo..."
|
|
|
|
git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$PHPDOC_GIT_DIR"
|
|
|
|
[ $? -eq 0 ] || exit 1
|
|
|
|
|
|
|
|
cd "$PHPDOC_GIT_DIR"
|
|
|
|
echo
|
|
|
|
|
|
|
|
# generate phpDocs
|
2015-11-25 23:29:14 +00:00
|
|
|
generate-phpdoc.sh \
|
2015-11-29 23:52:19 +00:00
|
|
|
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
|
2015-11-30 15:54:45 +00:00
|
|
|
"$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" \
|
2015-11-26 03:06:34 +00:00
|
|
|
"Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)"
|
2015-11-25 23:29:14 +00:00
|
|
|
[ $? -eq 0 ] || exit 1
|
|
|
|
|
2016-01-14 11:49:46 +00:00
|
|
|
# commit phpDocs
|
|
|
|
git add "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID"
|
|
|
|
git commit \
|
|
|
|
--message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \
|
|
|
|
"$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID"
|
|
|
|
[ $? -eq 0 ] || exit 1
|
|
|
|
|
2015-11-30 13:53:10 +00:00
|
|
|
# deploy phpDocs
|
2016-01-14 11:49:46 +00:00
|
|
|
github-deploy.sh "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT"
|
2015-11-25 23:29:14 +00:00
|
|
|
[ $? -eq 0 ] || exit 1
|