phpDocs auto deployment: Disable cache for releases

This commit is contained in:
Daniel Rudolf 2015-11-30 16:54:45 +01:00
parent c88a26beff
commit 47d2685c6d
3 changed files with 20 additions and 17 deletions

View file

@ -17,8 +17,6 @@ fi
PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
PHPDOC_CACHE_DIR="$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache"
PHPDOC_TARGET_DIR="$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID"
# clone repo
echo "Cloning repo..."
@ -31,7 +29,7 @@ echo
# generate phpDocs
generate-phpdoc.sh \
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
"$PHPDOC_CACHE_DIR" "$PHPDOC_TARGET_DIR" \
"$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" \
"Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)"
[ $? -eq 0 ] || exit 1

View file

@ -4,8 +4,6 @@
PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
PHPDOC_CACHE_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.cache"
PHPDOC_TARGET_DIR="$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID"
# clone repo
echo "Cloning repo..."
@ -18,7 +16,7 @@ echo
# generate phpDocs
generate-phpdoc.sh \
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
"$PHPDOC_CACHE_DIR" "$PHPDOC_TARGET_DIR" \
"-" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" \
"Pico 1.0 API Documentation ($TRAVIS_TAG)"
[ $? -eq 0 ] || exit 1

View file

@ -15,21 +15,28 @@ printf 'PHPDOC_TARGET_DIR="%s"\n' "$PHPDOC_TARGET_DIR"
printf 'PHPDOC_TITLE="%s"\n' "$PHPDOC_TITLE"
echo
# parse phpDoc files (i.e. update cache)
printf "\nUpdate phpDoc cache...\n"
phpdoc project:parse --config "$PHPDOC_CONFIG" \
--target "$PHPDOC_CACHE_DIR"
# update a separate phpDoc cache
if [ "$PHPDOC_CACHE_DIR" != "-" ]; then
# parse phpDoc files (i.e. update cache)
printf "\nUpdate phpDoc cache...\n"
phpdoc project:parse --config "$PHPDOC_CONFIG" \
--target "$PHPDOC_CACHE_DIR"
# check for changes
printf '\nCheck for phpDoc cache changes...\n'
if [ -z "$(git status --porcelain "$PHPDOC_CACHE_DIR")" ]; then
printf 'No changes detected; skipping phpDocs renewal...\n\n'
exit 0
# check for changes
printf '\nCheck for phpDoc cache changes...\n'
if [ -z "$(git status --porcelain "$PHPDOC_CACHE_DIR")" ]; then
printf 'No changes detected; skipping phpDocs renewal...\n\n'
exit 0
fi
# NOTE: actually the following command should be `phpdoc project:transform`
# instead of `phpdoc project:run`, but the command seems to be broken...
else
# create temporary cache files in PHPDOC_TARGET_DIR
PHPDOC_CACHE_DIR="$PHPDOC_TARGET_DIR"
fi
# transform phpDoc files (i.e. rewrite API docs)
# NOTE: actually this should be `phpdoc project:transform`,
# but the command seems to be broken...
printf '\nRewrite phpDocs...\n'
rm -rf "$PHPDOC_TARGET_DIR"
phpdoc project:run --config "$PHPDOC_CONFIG" \