diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index c86f756..40b82e9 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -22,15 +22,14 @@ DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" [ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages" # clone repo -echo "Cloning repo..." -git clone --branch="$DEPLOY_REPO_BRANCH" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOYMENT_DIR" +github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" [ $? -eq 0 ] || exit 1 cd "$DEPLOYMENT_DIR" -echo # setup repo github-setup.sh +[ $? -eq 0 ] || exit 1 # generate phpDocs generate-phpdoc.sh \ @@ -44,6 +43,7 @@ generate-phpdoc.sh \ update-phpdoc-list.sh \ "$DEPLOYMENT_DIR/_data/phpDoc.yml" \ "$TRAVIS_BRANCH" "branch" "$TRAVIS_BRANCH branch" "$(date +%s)" +[ $? -eq 0 ] || exit 1 # commit phpDocs echo "Committing changes..." diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index d4c7448..0d8c342 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -20,15 +20,14 @@ DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" [ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages" # clone repo -echo "Cloning repo..." -git clone --branch="$DEPLOY_REPO_BRANCH" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOYMENT_DIR" +github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" [ $? -eq 0 ] || exit 1 cd "$DEPLOYMENT_DIR" -echo # setup repo github-setup.sh +[ $? -eq 0 ] || exit 1 # generate phpDocs if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then @@ -43,6 +42,7 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then update-phpdoc-list.sh \ "$DEPLOYMENT_DIR/_data/phpDoc.yml" \ "$TRAVIS_TAG" "version" "Pico ${TRAVIS_TAG#v}" "$(date +%s)" + [ $? -eq 0 ] || exit 1 # commit phpDocs echo "Committing phpDoc changes..." @@ -60,6 +60,7 @@ if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then generate-badge.sh \ "$DEPLOYMENT_DIR/badges/pico-version.svg" \ "release" "$TRAVIS_TAG" "blue" + [ $? -eq 0 ] || exit 1 # commit version badge echo "Committing version badge..." @@ -76,6 +77,7 @@ if [ "$DEPLOY_VERSION_FILE" == "true" ]; then update-version-file.sh \ "$DEPLOYMENT_DIR/_data/version.yml" \ "${TRAVIS_TAG#v}" + [ $? -eq 0 ] || exit 1 # commit version file echo "Committing version file..." diff --git a/_build/github-clone.sh b/_build/github-clone.sh new file mode 100755 index 0000000..2937ecd --- /dev/null +++ b/_build/github-clone.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +## +# Clones a Git repo +# +# @author Daniel Rudolf +# @link http://picocms.org +# @license http://opensource.org/licenses/MIT +# + +set -e + +# parameters +CLONE_TARGET_DIR="$1" # target directory +CLONE_REPO_URL="$2" # URL of the git repo to clone +CLONE_REPO_BRANCH="$3" # optional branch to checkout + +# print parameters +echo "Cloning repo..." +printf 'CLONE_TARGET_DIR="%s"\n' "$CLONE_TARGET_DIR" +printf 'CLONE_REPO_URL="%s"\n' "$CLONE_REPO_URL" +printf 'CLONE_REPO_BRANCH="%s"\n' "$CLONE_REPO_BRANCH" +echo + +# clone repo +git clone "$CLONE_REPO_URL" "$CLONE_TARGET_DIR" + +# checkout branch +if [ -n "$CLONE_REPO_BRANCH" ]; then + git checkout "$CLONE_REPO_BRANCH" +fi + +echo