diff --git a/_build/deploy-branch.sh b/_build/deploy-branch.sh index a3ac6fd..d3be5be 100755 --- a/_build/deploy-branch.sh +++ b/_build/deploy-branch.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e export PATH="$(dirname "$0")/tools:$PATH" @@ -14,27 +15,27 @@ MILESTONE="Pico$([[ "$VERSION" =~ ^([0-9]+\.[0-9]+)\. ]] && echo " ${BASH_REMATC # clone repo github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" -[ $? -eq 0 ] || exit 1 cd "$DEPLOYMENT_DIR" # setup repo github-setup.sh -[ $? -eq 0 ] || exit 1 # generate phpDocs generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ "$MILESTONE API Documentation ($TRAVIS_BRANCH branch)" -[ $? -eq 0 ] || exit 1 -[ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache")" ] || exit 0 + +if [ -z "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache")" ]; then + # nothing to do + exit 0 +fi # update phpDoc list 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..." @@ -45,9 +46,7 @@ git commit \ --message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \ "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ "$DEPLOYMENT_DIR/_data/phpDoc.yml" -[ $? -eq 0 ] || exit 1 echo # deploy phpDocs github-deploy.sh "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT" -[ $? -eq 0 ] || exit 1 diff --git a/_build/deploy-release.sh b/_build/deploy-release.sh index 1c994ab..e441914 100755 --- a/_build/deploy-release.sh +++ b/_build/deploy-release.sh @@ -1,21 +1,39 @@ #!/usr/bin/env bash +set -e +DEPLOY_FULL="true" if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ]; then echo "Skipping phpDoc release deployment because it has been disabled" + DEPLOY_FULL="false" fi if [ "$DEPLOY_VERSION_BADGE" != "true" ]; then echo "Skipping version badge deployment because it has been disabled" + DEPLOY_FULL="false" fi if [ "$DEPLOY_VERSION_FILE" != "true" ]; then echo "Skipping version file deployment because it has been disabled" + DEPLOY_FULL="false" fi -if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] || [ "$DEPLOY_VERSION_BADGE" != "true" ] || [ "$DEPLOY_VERSION_FILE" != "true" ] || [ "$DEPLOY_CLOC_STATS" != "true" ]; then - [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && [ "$DEPLOY_VERSION_FILE" != "true" ] && [ "$DEPLOY_CLOC_STATS" != "true" ] && exit 0 || echo +if [ "$DEPLOY_CLOC_STATS" != "true" ]; then + echo "Skipping cloc statistics deployment because it has been disabled" + DEPLOY_FULL="false" +fi + +if [ "$DEPLOY_FULL" != "true" ]; then + if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] \ + && [ "$DEPLOY_VERSION_BADGE" != "true" ] \ + && [ "$DEPLOY_VERSION_FILE" != "true" ] \ + && [ "$DEPLOY_CLOC_STATS" != "true" ] + then + # nothing to do + exit 0 + fi + echo fi export PATH="$(dirname "$0")/tools:$PATH" -DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}" +DEPLOYMENT_ID="${TRAVIS_TAG//\//_}" DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" [ -n "$DEPLOY_REPO_SLUG" ] || export DEPLOY_REPO_SLUG="$TRAVIS_REPO_SLUG" @@ -23,13 +41,11 @@ DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" # clone repo github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" -[ $? -eq 0 ] || exit 1 cd "$DEPLOYMENT_DIR" # setup repo github-setup.sh -[ $? -eq 0 ] || exit 1 # generate phpDocs if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then @@ -41,14 +57,12 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ "-" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ "$MILESTONE API Documentation ($TRAVIS_TAG)" - [ $? -eq 0 ] || exit 1 if [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID")" ]; then # update phpDoc list 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..." @@ -56,7 +70,6 @@ if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then git commit \ --message="Update phpDocumentor class docs for $TRAVIS_TAG" \ "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml" - [ $? -eq 0 ] || exit 1 echo fi fi @@ -66,7 +79,6 @@ 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..." @@ -74,7 +86,6 @@ if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then git commit \ --message="Update version badge for $TRAVIS_TAG" \ "$DEPLOYMENT_DIR/badges/pico-version.svg" - [ $? -eq 0 ] || exit 1 echo fi @@ -83,7 +94,6 @@ 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..." @@ -91,7 +101,6 @@ if [ "$DEPLOY_VERSION_FILE" == "true" ]; then git commit \ --message="Update version file for $TRAVIS_TAG" \ "$DEPLOYMENT_DIR/_data/version.yml" - [ $? -eq 0 ] || exit 1 echo fi @@ -100,7 +109,6 @@ if [ "$DEPLOY_CLOC_STATS" == "true" ]; then update-cloc-stats.sh \ "$DEPLOYMENT_DIR/_data/clocCore.yml" \ "$DEPLOYMENT_DIR/_data/clocRelease.yml" - [ $? -eq 0 ] || exit 1 # commit cloc statistics echo "Commiting cloc statistics..." @@ -108,10 +116,8 @@ if [ "$DEPLOY_CLOC_STATS" == "true" ]; then git commit \ --message="Update cloc statistics for $TRAVIS_TAG" \ "$DEPLOYMENT_DIR/_data/clocCore.yml" "$DEPLOYMENT_DIR/_data/clocRelease.yml" - [ $? -eq 0 ] || exit 1 echo fi # deploy github-deploy.sh "$TRAVIS_REPO_SLUG" "tags/$TRAVIS_TAG" "$TRAVIS_COMMIT" -[ $? -eq 0 ] || exit 1 diff --git a/_build/install.sh b/_build/install.sh index b469994..a345371 100755 --- a/_build/install.sh +++ b/_build/install.sh @@ -1,5 +1,10 @@ #!/usr/bin/env bash +# let composer use our GITHUB_OAUTH_TOKEN +if [ -n "$GITHUB_OAUTH_TOKEN" ]; then + composer config --global github-oauth.github.com "$GITHUB_OAUTH_TOKEN" +fi + if [ "$1" == "--release" ]; then # install dependencies echo "Running \`composer install\`..." @@ -40,6 +45,6 @@ fi # install dependencies echo "Running \`composer install\`$([ -n "$COMPOSER_ROOT_VERSION" ] && echo -n " ($COMPOSER_ROOT_VERSION)")..." -composer install +composer install --no-suggest exit $?