phpDocs auto deployment: Fix deployment of branches

This commit is contained in:
Daniel Rudolf 2015-11-25 23:09:15 +01:00
parent c198333de7
commit 236ae43dab
2 changed files with 7 additions and 7 deletions

View file

@ -27,14 +27,14 @@ after_success:
[ "$TRAVIS_PHP_VERSION" != "5.3" ] && echo "Skipping phpDoc deployment because this is not on the required runtime" && exit
[[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]] && echo "Skipping phpDoc deployment because this branch is not permitted to deploy" && exit
[ "$TRAVIS_SECURE_ENV_VARS" != "true" ] && echo "Skipping phpDoc deployment because this is no environment with write access to the repository" && exit
./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master)"
./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "master @ $TRAVIS_COMMIT" "phpDoc/master" "gh-pages"
./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_BRANCH" "Pico 1.0 API Documentation ($TRAVIS_BRANCH)" || exit 1
./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_BRANCH" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "phpDoc/$TRAVIS_BRANCH" "gh-pages" || exit 1
before_deploy:
- |
[ "$DEPLOY_PHPDOC_TAGS" == "true" ] && (
./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)"
./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages"
./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" || exit 1
./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" || exit 1
)
- composer install --no-dev --optimize-autoloader
- tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php

View file

@ -31,7 +31,7 @@ elif [[ "$SOURCE_REF" == *" @ "* ]]; then
SOURCE_REF_BRANCH="${SOURCE_REF% @ *}"
SOURCE_REF_COMMIT="${SOURCE_REF##* @ }"
if ! git check-ref-format "heads/$SOURCE_REF_BRANCH" || ! git rev-parse --verify "$SOURCE_REF_COMMIT"; then
if ! git check-ref-format "heads/$SOURCE_REF_BRANCH" || ! git rev-parse --verify "$SOURCE_REF_COMMIT" > /dev/null; then
echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2
exit 1
fi
@ -74,7 +74,7 @@ git commit -m "Update phpDocumentor class docs for $SOURCE_REF"
# but it should give a basic protection without disabling concurrent builds completely
if [ "$SOURCE_REF_TYPE" == "commit" ]; then
# get latest commit
printf '\nRetrieving latest commit of %s:%s' "$GITHUB_SLUG" "$SOURCE_REF_BRANCH"
printf '\nRetrieving latest commit...\n'
LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$GITHUB_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" 2> /dev/null | php -r "
\$json = json_decode(stream_get_contents(STDIN), true);
if (\$json !== null) {
@ -88,7 +88,7 @@ if [ "$SOURCE_REF_TYPE" == "commit" ]; then
# compare target reference against the latest commit
if [ "$LATEST_COMMIT" != "$SOURCE_REF_COMMIT" ]; then
echo "WARNING: $APP_NAME target reference '$SOURCE_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2
echo "WARNING: $APP_NAME source reference '$SOURCE_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2
exit 0
fi
fi