From 92026a3bd0f49223cdf8fb0383e016cebe6fc031 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 12:49:46 +0100 Subject: [PATCH 01/17] Add static shields.io badge generator --- _build/deploy-phpdoc-branch.sh | 13 +++-- _build/deploy-phpdoc-release.sh | 32 ++++++++--- _build/generate-badge.sh | 55 +++++++++++++++++++ _build/{deploy-phpdoc.sh => github-deploy.sh} | 29 +++++----- 4 files changed, 103 insertions(+), 26 deletions(-) create mode 100755 _build/generate-badge.sh rename _build/{deploy-phpdoc.sh => github-deploy.sh} (83%) diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index fd4eaba..b3238a0 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -33,8 +33,13 @@ generate-phpdoc.sh \ "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" [ $? -eq 0 ] || exit 1 -# deploy phpDocs -deploy-phpdoc.sh \ - "Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \ - "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT" +# 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 + +# deploy phpDocs +github-deploy.sh "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT" [ $? -eq 0 ] || exit 1 diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index e613808..1f7b8c5 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -3,25 +3,41 @@ [ "$DEPLOY_PHPDOC_RELEASES" == "true" ] || exit PHPDOC_ID="${TRAVIS_BRANCH//\//_}" -PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git" +GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git" # clone repo echo "Cloning repo..." -git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$PHPDOC_GIT_DIR" +git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$GIT_DIR" [ $? -eq 0 ] || exit 1 -cd "$PHPDOC_GIT_DIR" +cd "$GIT_DIR" echo # generate phpDocs generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ - "-" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" \ + "-" "$GIT_DIR/phpDoc/$PHPDOC_ID" \ "Pico 1.0 API Documentation ($TRAVIS_TAG)" [ $? -eq 0 ] || exit 1 -# deploy phpDocs -deploy-phpdoc.sh \ - "Update phpDocumentor class docs for $TRAVIS_TAG" \ - "$TRAVIS_REPO_SLUG" "tags/$TRAVIS_TAG" "$TRAVIS_COMMIT" +# commit phpDocs +git add "$GIT_DIR/phpDoc/$PHPDOC_ID" +git commit \ + --message="Update phpDocumentor class docs for $TRAVIS_TAG" \ + "$GIT_DIR/phpDoc/$PHPDOC_ID" +[ $? -eq 0 ] || exit 1 + +# update version badge +gnerate-badge.sh \ + "$GIT_DIR/badges/pico-version.svg" \ + "release" "v$TRAVIS_TAG" "blue" + +# commit version badge +git add "$GIT_DIR/badges/pico-version.svg" +git commit \ + --message="Update version badge for $TRAVIS_TAG" \ + "$GIT_DIR/badges/pico-version.svg" + +# deploy +github-deploy.sh "$TRAVIS_REPO_SLUG" "tags/$TRAVIS_TAG" "$TRAVIS_COMMIT" [ $? -eq 0 ] || exit 1 diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh new file mode 100755 index 0000000..e478242 --- /dev/null +++ b/_build/generate-badge.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +## +# Downloads a custom badge from shields.io +# +# All credit goes to the awesome guys at shields.io! +# +# @see http://shields.io/ +# +# @author Daniel Rudolf +# @link http://picocms.org +# @license http://opensource.org/licenses/MIT +# + +set -e + +# parameters +BADGE_FILE_PATH="$1" +BADGE_SUBJECT="$2" +BADGE_STATUS="$3" +BADGE_COLOR="$4" + +# print parameters +echo "Generating badge..." +printf 'BADGE_FILE_PATH="%s"\n' "$BADGE_FILE_PATH" +printf 'BADGE_SUBJECT="%s"\n' "$BADGE_SUBJECT" +printf 'BADGE_STATUS="%s"\n' "$BADGE_STATUS" +printf 'BADGE_COLOR="%s"\n' "$BADGE_COLOR" +echo + +# download badge from shields.io +printf 'Downloading badge...\n' +TMP_BADGE="$(mktemp -u)" + +wget -O "$TMP_BADGE" \ + "https://img.shields.io/badge/$BADGE_SUBJECT-$BADGE_STATUS-$BADGE_COLOR.svg" + +# validate badge +if [ ! -f "$TMP_BADGE" ]; then + echo "Unable to generate badge; aborting...\n" >&2 + exit 1 +fi + +# MIME type image/svg+xml isn't supported at the moment +# +#TMP_BADGE_MIME="$(file --mime-type "$TMP_BADGE" | cut -d ' ' -f 2)" +#if [ "$TMP_BADGE_MIME" != "image/svg+xml" ]; then +# echo "Generated badge should be of type 'image/svg+xml', '$TMP_BADGE_MIME' given; aborting...\n" >&2 +# exit 1 +#fi + +# deploy badge +mv "$TMP_BADGE" "$BADGE_FILE_PATH" + +echo diff --git a/_build/deploy-phpdoc.sh b/_build/github-deploy.sh similarity index 83% rename from _build/deploy-phpdoc.sh rename to _build/github-deploy.sh index dea8366..9d4e08b 100755 --- a/_build/deploy-phpdoc.sh +++ b/_build/github-deploy.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash ## -# Deploys phpDoc class documentation +# Pushes commits to a GitHub repo # # @author Daniel Rudolf # @link http://picocms.org @@ -14,22 +14,26 @@ set -e # GITHUB_OAUTH_TOKEN GitHub authentication token, see https://github.com/settings/tokens # parameters -COMMIT_MESSAGE="$1" # commit message -CHECK_REPO_SLUG="$2" # optional GitHub repo (e.g. picocms/Pico) to check +CHECK_REPO_SLUG="$1" # optional GitHub repo (e.g. picocms/Pico) to check # its latest commit as basic race condition protection -CHECK_REMOTE_REF="$3" # optional remote Git reference (e.g. heads/master) -CHECK_LOCAL_COMMIT="$4" # optional local commit SHA1 +CHECK_REMOTE_REF="$2" # optional remote Git reference (e.g. heads/master) +CHECK_LOCAL_COMMIT="$3" # optional local commit SHA1 # print parameters -echo "Deploying phpDocs..." -printf 'COMMIT_MESSAGE="%s"\n' "$COMMIT_MESSAGE" +echo "Deploying repo..." printf 'CHECK_REPO_SLUG="%s"\n' "$CHECK_REPO_SLUG" printf 'CHECK_REMOTE_REF="%s"\n' "$CHECK_REMOTE_REF" printf 'CHECK_LOCAL_COMMIT="%s"\n' "$CHECK_LOCAL_COMMIT" echo +# check for git repo +if ! git rev-parse --git-dir > /dev/null 2>&1; then + printf 'Not a git repo; aborting...\n\n' + exit 1 +fi + # check for changes -if [ -z "$(git status --porcelain)" ]; then +if [ -z "$(git log --oneline '@{upstream}..')" ]; then printf 'Nothing to deploy; skipping...\n\n' exit 0 fi @@ -45,11 +49,6 @@ if [ -n "$GITHUB_OAUTH_TOKEN" ]; then (umask 077 && echo "https://GitHub:$GITHUB_OAUTH_TOKEN@github.com" > .git/credentials) fi -# commit changes -printf '\nCommiting changes...\n' -git add --all -git commit --message="$COMMIT_MESSAGE" - # race condition protection for concurrent Travis builds # this is no definite protection (race conditions are still possible during `git push`), # but it should give a basic protection without disabling concurrent builds completely @@ -84,6 +83,8 @@ fi # push changes printf '\nPushing changes...\n' -git push origin +git push +EXIT_CODE=$? echo +exit $EXIT_CODE From d7ebf52ec9a4fbf8ab75cfd1d519fbb519413a82 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 12:53:11 +0100 Subject: [PATCH 02/17] RADME.md: Update badge URLs Resolves #314 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da1fb7b..9b9667d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ Pico ==== -[![License](https://img.shields.io/github/license/picocms/Pico.svg)](https://github.com/picocms/Pico/blob/master/LICENSE.md) -[![Version](https://img.shields.io/github/release/picocms/Pico.svg)](https://github.com/picocms/Pico/releases/latest) -[![Build Status](https://img.shields.io/travis/picocms/Pico.svg)](https://travis-ci.org/picocms/Pico) -[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/theshka/pico.svg)](https://scrutinizer-ci.com/g/theshka/Pico/?branch=master) +[![License](picocms.org/badges/pico-license.svg)](https://github.com/picocms/Pico/blob/master/LICENSE.md) +[![Version](picocms.org/badges/pico-version.svg)](https://github.com/picocms/Pico/releases/latest) +[![Build Status](https://api.travis-ci.org/picocms/Pico.svg)](https://travis-ci.org/picocms/Pico) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/theshka/Pico/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/theshka/Pico/?branch=master) [![Tweet Button](https://cloud.githubusercontent.com/assets/640217/11483728/b0842918-976f-11e5-9185-d53261b3125b.png)](https://twitter.com/intent/tweet?text=Pico+is+a+stupidly+simple%2C+blazing+fast%2C+flat+file+CMS.+Visit+http%3A%2F%2Fpicocms.org+and+downlaod+%23picocms+today%21+via+%40gitpicocms&related=gitpicocms) Pico is a stupidly simple, blazing fast, flat file CMS. See http://picocms.org/ for more info. From 8554c0a60d8828554a5ad7af4d951afe23f8487e Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 12:58:12 +0100 Subject: [PATCH 03/17] RADME.md: Update badge URLs Fixes mixed content warnings --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b9667d..7efcccb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Pico ==== -[![License](picocms.org/badges/pico-license.svg)](https://github.com/picocms/Pico/blob/master/LICENSE.md) -[![Version](picocms.org/badges/pico-version.svg)](https://github.com/picocms/Pico/releases/latest) +[![License](https://picocms.github.io/Pico/badges/pico-license.svg)](https://github.com/picocms/Pico/blob/master/LICENSE.md) +[![Version](https://picocms.github.io/Pico/badges/pico-version.svg)](https://github.com/picocms/Pico/releases/latest) [![Build Status](https://api.travis-ci.org/picocms/Pico.svg)](https://travis-ci.org/picocms/Pico) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/theshka/Pico/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/theshka/Pico/?branch=master) [![Tweet Button](https://cloud.githubusercontent.com/assets/640217/11483728/b0842918-976f-11e5-9185-d53261b3125b.png)](https://twitter.com/intent/tweet?text=Pico+is+a+stupidly+simple%2C+blazing+fast%2C+flat+file+CMS.+Visit+http%3A%2F%2Fpicocms.org+and+downlaod+%23picocms+today%21+via+%40gitpicocms&related=gitpicocms) From cd0e0f706f0eee7ef0d8785c0612a68a94721471 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 13:12:10 +0100 Subject: [PATCH 04/17] Build scripts: Git identity must be configured before committing --- _build/deploy-phpdoc-branch.sh | 3 +++ _build/deploy-phpdoc-release.sh | 3 +++ _build/generate-badge.sh | 8 ++++---- _build/github-deploy.sh | 20 ------------------- _build/github-setup.sh | 35 +++++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 24 deletions(-) create mode 100755 _build/github-setup.sh diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index b3238a0..8687170 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -26,6 +26,9 @@ git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$PHPDO cd "$PHPDOC_GIT_DIR" echo +# setup repo +github-setup.sh + # generate phpDocs generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index 1f7b8c5..3384192 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -13,6 +13,9 @@ git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$GIT_D cd "$GIT_DIR" echo +# setup repo +github-setup.sh + # generate phpDocs generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh index e478242..d1aed73 100755 --- a/_build/generate-badge.sh +++ b/_build/generate-badge.sh @@ -15,10 +15,10 @@ set -e # parameters -BADGE_FILE_PATH="$1" -BADGE_SUBJECT="$2" -BADGE_STATUS="$3" -BADGE_COLOR="$4" +BADGE_FILE_PATH="$1" # target file path +BADGE_SUBJECT="$2" # subject (left half) of the badge +BADGE_STATUS="$3" # status (right half) of the badge +BADGE_COLOR="$4" # color of the badge # print parameters echo "Generating badge..." diff --git a/_build/github-deploy.sh b/_build/github-deploy.sh index 9d4e08b..993631a 100755 --- a/_build/github-deploy.sh +++ b/_build/github-deploy.sh @@ -10,9 +10,6 @@ set -e -# environment variables -# GITHUB_OAUTH_TOKEN GitHub authentication token, see https://github.com/settings/tokens - # parameters CHECK_REPO_SLUG="$1" # optional GitHub repo (e.g. picocms/Pico) to check # its latest commit as basic race condition protection @@ -26,29 +23,12 @@ printf 'CHECK_REMOTE_REF="%s"\n' "$CHECK_REMOTE_REF" printf 'CHECK_LOCAL_COMMIT="%s"\n' "$CHECK_LOCAL_COMMIT" echo -# check for git repo -if ! git rev-parse --git-dir > /dev/null 2>&1; then - printf 'Not a git repo; aborting...\n\n' - exit 1 -fi - # check for changes if [ -z "$(git log --oneline '@{upstream}..')" ]; then printf 'Nothing to deploy; skipping...\n\n' exit 0 fi -# setup git -printf 'Preparing repo...\n' -git config push.default simple -git config user.name "Travis CI" -git config user.email "travis-ci@picocms.org" - -if [ -n "$GITHUB_OAUTH_TOKEN" ]; then - git config credential.helper 'store --file=.git/credentials' - (umask 077 && echo "https://GitHub:$GITHUB_OAUTH_TOKEN@github.com" > .git/credentials) -fi - # race condition protection for concurrent Travis builds # this is no definite protection (race conditions are still possible during `git push`), # but it should give a basic protection without disabling concurrent builds completely diff --git a/_build/github-setup.sh b/_build/github-setup.sh new file mode 100755 index 0000000..cce661d --- /dev/null +++ b/_build/github-setup.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +## +# Prepares a GitHub repo for deployment +# +# @author Daniel Rudolf +# @link http://picocms.org +# @license http://opensource.org/licenses/MIT +# + +set -e + +# environment variables +# GITHUB_OAUTH_TOKEN GitHub authentication token, see https://github.com/settings/tokens + +# print "parameters" (we don't have any) +echo "Setup repo..." +echo + +# check for git repo +if ! git rev-parse --git-dir > /dev/null 2>&1; then + printf 'Not a git repo; aborting...\n\n' + exit 1 +fi + +# setup git +printf 'Preparing repo...\n' +git config push.default simple +git config user.name "Travis CI" +git config user.email "travis-ci@picocms.org" + +if [ -n "$GITHUB_OAUTH_TOKEN" ]; then + git config credential.helper 'store --file=.git/credentials' + (umask 077 && echo "https://GitHub:$GITHUB_OAUTH_TOKEN@github.com" > .git/credentials) +fi \ No newline at end of file From b472664a2040464f8531bf4f47b1cd8f988d0762 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 13:20:04 +0100 Subject: [PATCH 05/17] Build scripts: Don't try to commit nothing --- _build/deploy-phpdoc-branch.sh | 1 + _build/github-setup.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index 8687170..f65708f 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -35,6 +35,7 @@ generate-phpdoc.sh \ "$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 +[ -n "$(git status --porcelain "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache")" ] || exit 0 # commit phpDocs git add "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" diff --git a/_build/github-setup.sh b/_build/github-setup.sh index cce661d..9dabef4 100755 --- a/_build/github-setup.sh +++ b/_build/github-setup.sh @@ -32,4 +32,4 @@ git config user.email "travis-ci@picocms.org" if [ -n "$GITHUB_OAUTH_TOKEN" ]; then git config credential.helper 'store --file=.git/credentials' (umask 077 && echo "https://GitHub:$GITHUB_OAUTH_TOKEN@github.com" > .git/credentials) -fi \ No newline at end of file +fi From 26d7d2f68edc5f0f2e04bb41719fc8e2997b9c3c Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 13:35:08 +0100 Subject: [PATCH 06/17] Build scripts: Fix formatting --- _build/deploy-phpdoc-branch.sh | 2 ++ _build/deploy-phpdoc-release.sh | 2 ++ _build/github-deploy.sh | 6 ++++-- _build/github-setup.sh | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index f65708f..16c3178 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -38,11 +38,13 @@ generate-phpdoc.sh \ [ -n "$(git status --porcelain "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache")" ] || exit 0 # commit phpDocs +echo "Committing changes..." 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 +echo # deploy phpDocs github-deploy.sh "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT" diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index 3384192..e0e7836 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -24,11 +24,13 @@ generate-phpdoc.sh \ [ $? -eq 0 ] || exit 1 # commit phpDocs +echo "Committing changes..." git add "$GIT_DIR/phpDoc/$PHPDOC_ID" git commit \ --message="Update phpDocumentor class docs for $TRAVIS_TAG" \ "$GIT_DIR/phpDoc/$PHPDOC_ID" [ $? -eq 0 ] || exit 1 +echo # update version badge gnerate-badge.sh \ diff --git a/_build/github-deploy.sh b/_build/github-deploy.sh index 993631a..61cfda0 100755 --- a/_build/github-deploy.sh +++ b/_build/github-deploy.sh @@ -34,7 +34,7 @@ fi # but it should give a basic protection without disabling concurrent builds completely if [ -n "$CHECK_REPO_SLUG" ] && [ -n "$CHECK_REMOTE_REF" ] && [ -n "$CHECK_LOCAL_COMMIT" ]; then # retrieve information using GitHub APIv3 - printf '\nChecking latest commit...\n' + printf 'Checking latest commit...\n' CHECK_API_URL="https://api.github.com/repos/$CHECK_REPO_SLUG/git/refs/$CHECK_REMOTE_REF" if [ -n "$GITHUB_OAUTH_TOKEN" ]; then CHECK_API_RESPONSE="$(wget -O- --header="Authorization: token $GITHUB_OAUTH_TOKEN" "$CHECK_API_URL" 2> /dev/null)" @@ -59,10 +59,12 @@ if [ -n "$CHECK_REPO_SLUG" ] && [ -n "$CHECK_REMOTE_REF" ] && [ -n "$CHECK_LOCAL echo "WARNING: latest local commit '$CHECK_LOCAL_COMMIT' doesn't match latest remote commit '$CHECK_REMOTE_COMMIT'" >&2 exit 0 fi + + echo fi # push changes -printf '\nPushing changes...\n' +printf 'Pushing changes...\n' git push EXIT_CODE=$? diff --git a/_build/github-setup.sh b/_build/github-setup.sh index 9dabef4..11aa76b 100755 --- a/_build/github-setup.sh +++ b/_build/github-setup.sh @@ -19,7 +19,7 @@ echo # check for git repo if ! git rev-parse --git-dir > /dev/null 2>&1; then - printf 'Not a git repo; aborting...\n\n' + printf 'Not a git repo; aborting...\n\n' >&2 exit 1 fi @@ -33,3 +33,5 @@ if [ -n "$GITHUB_OAUTH_TOKEN" ]; then git config credential.helper 'store --file=.git/credentials' (umask 077 && echo "https://GitHub:$GITHUB_OAUTH_TOKEN@github.com" > .git/credentials) fi + +echo From 2ed32d67a734f6ab590e5bf15754c432ac4da9d9 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 14:16:14 +0100 Subject: [PATCH 07/17] Update _build/deploy-phpdoc-release.sh --- _build/deploy-phpdoc-release.sh | 61 +++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index e0e7836..58888e5 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -1,6 +1,14 @@ #!/usr/bin/env bash -[ "$DEPLOY_PHPDOC_RELEASES" == "true" ] || exit +if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ]; then + echo "Skipping phpDoc release deployment because it has been disabled" +fi +if [ "$DEPLOY_VERSION_BADGE" != "true" ]; then + echo "Skipping version badge deployment because it has been disabled" +fi +if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] || [ "$DEPLOY_VERSION_BADGE" != "true" ]; then + [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && exit || echo +fi PHPDOC_ID="${TRAVIS_BRANCH//\//_}" GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git" @@ -17,31 +25,40 @@ echo github-setup.sh # generate phpDocs -generate-phpdoc.sh \ - "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ - "-" "$GIT_DIR/phpDoc/$PHPDOC_ID" \ - "Pico 1.0 API Documentation ($TRAVIS_TAG)" -[ $? -eq 0 ] || exit 1 +if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then + generate-phpdoc.sh \ + "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ + "-" "$GIT_DIR/phpDoc/$PHPDOC_ID" \ + "Pico 1.0 API Documentation ($TRAVIS_TAG)" + [ $? -eq 0 ] || exit 1 -# commit phpDocs -echo "Committing changes..." -git add "$GIT_DIR/phpDoc/$PHPDOC_ID" -git commit \ - --message="Update phpDocumentor class docs for $TRAVIS_TAG" \ - "$GIT_DIR/phpDoc/$PHPDOC_ID" -[ $? -eq 0 ] || exit 1 -echo + # commit phpDocs + if [ -n "$(git status --porcelain "$GIT_DIR/phpDoc/$PHPDOC_ID")" ]; then + echo "Committing phpDoc changes..." + git add "$GIT_DIR/phpDoc/$PHPDOC_ID" + git commit \ + --message="Update phpDocumentor class docs for $TRAVIS_TAG" \ + "$GIT_DIR/phpDoc/$PHPDOC_ID" + [ $? -eq 0 ] || exit 1 + echo + fi +fi # update version badge -gnerate-badge.sh \ - "$GIT_DIR/badges/pico-version.svg" \ - "release" "v$TRAVIS_TAG" "blue" +if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then + generate-badge.sh \ + "$GIT_DIR/badges/pico-version.svg" \ + "release" "v$TRAVIS_TAG" "blue" -# commit version badge -git add "$GIT_DIR/badges/pico-version.svg" -git commit \ - --message="Update version badge for $TRAVIS_TAG" \ - "$GIT_DIR/badges/pico-version.svg" + # commit version badge + echo "Committing changes..." + git add "$GIT_DIR/badges/pico-version.svg" + git commit \ + --message="Update version badge for $TRAVIS_TAG" \ + "$GIT_DIR/badges/pico-version.svg" + [ $? -eq 0 ] || exit 1 + echo +fi # deploy github-deploy.sh "$TRAVIS_REPO_SLUG" "tags/$TRAVIS_TAG" "$TRAVIS_COMMIT" From 8c24e32f1019d7f077cdcef513f41d8f613afadf Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 14:16:24 +0100 Subject: [PATCH 08/17] Build scripts: Fix formatting --- _build/generate-badge.sh | 4 ++-- _build/github-deploy.sh | 2 +- _build/github-setup.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh index d1aed73..94e694b 100755 --- a/_build/generate-badge.sh +++ b/_build/generate-badge.sh @@ -37,8 +37,8 @@ wget -O "$TMP_BADGE" \ # validate badge if [ ! -f "$TMP_BADGE" ]; then - echo "Unable to generate badge; aborting...\n" >&2 - exit 1 + printf 'Unable to generate badge; skipping...\n\n' + exit 0 fi # MIME type image/svg+xml isn't supported at the moment diff --git a/_build/github-deploy.sh b/_build/github-deploy.sh index 61cfda0..bfe32b9 100755 --- a/_build/github-deploy.sh +++ b/_build/github-deploy.sh @@ -56,7 +56,7 @@ if [ -n "$CHECK_REPO_SLUG" ] && [ -n "$CHECK_REMOTE_REF" ] && [ -n "$CHECK_LOCAL # compare source reference against the latest commit if [ "$CHECK_REMOTE_COMMIT" != "$CHECK_LOCAL_COMMIT" ]; then - echo "WARNING: latest local commit '$CHECK_LOCAL_COMMIT' doesn't match latest remote commit '$CHECK_REMOTE_COMMIT'" >&2 + echo "Latest local commit '$CHECK_LOCAL_COMMIT' doesn't match latest remote commit '$CHECK_REMOTE_COMMIT'; aborting..." >&2 exit 0 fi diff --git a/_build/github-setup.sh b/_build/github-setup.sh index 11aa76b..a9697cb 100755 --- a/_build/github-setup.sh +++ b/_build/github-setup.sh @@ -19,7 +19,7 @@ echo # check for git repo if ! git rev-parse --git-dir > /dev/null 2>&1; then - printf 'Not a git repo; aborting...\n\n' >&2 + echo "Not a git repo; aborting..." >&2 exit 1 fi From 024f994d9e9e12d71fee298c3c769ca2db6bd683 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 14:51:16 +0100 Subject: [PATCH 09/17] _build/deploy-phpdoc-branch.sh: Don't forget to commit phpDocs cache --- _build/deploy-phpdoc-branch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index 16c3178..373a6e8 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -39,10 +39,10 @@ generate-phpdoc.sh \ # commit phpDocs echo "Committing changes..." -git add "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" +git add "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$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" + "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" [ $? -eq 0 ] || exit 1 echo From 4f60289d36e26b1e2fa8339f5d2878a2cce601fc Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 15:16:14 +0100 Subject: [PATCH 10/17] _build/deploy-phpdoc-release.sh: Fix version badge status --- _build/deploy-phpdoc-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index 58888e5..02dcea9 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -48,7 +48,7 @@ fi if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then generate-badge.sh \ "$GIT_DIR/badges/pico-version.svg" \ - "release" "v$TRAVIS_TAG" "blue" + "release" "$TRAVIS_TAG" "blue" # commit version badge echo "Committing changes..." From 1561786f3167b23a903a4be0d35cbb065e3c10b6 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 16:02:34 +0100 Subject: [PATCH 11/17] _build/generate-badge.sh: Connect to shields.io using SSLv3 This is necessary due to a strange TLS bug in Ubuntu 12.04 LTS used by Travis CI. See https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/861137 for details. --- _build/generate-badge.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh index 94e694b..bee3375 100755 --- a/_build/generate-badge.sh +++ b/_build/generate-badge.sh @@ -29,10 +29,13 @@ printf 'BADGE_COLOR="%s"\n' "$BADGE_COLOR" echo # download badge from shields.io +# use SSLv3 due to a strange TLS bug in Ubuntu 12.04 LTS used by Travis CI +# see https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/861137 for details printf 'Downloading badge...\n' TMP_BADGE="$(mktemp -u)" -wget -O "$TMP_BADGE" \ +wget --secure-protocol=SSLv3 \ + -O "$TMP_BADGE" \ "https://img.shields.io/badge/$BADGE_SUBJECT-$BADGE_STATUS-$BADGE_COLOR.svg" # validate badge From 9f0c7bde5d97a0ca90cedade2f32ba7adad3b0f8 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 16:24:10 +0100 Subject: [PATCH 12/17] Revert "_build/generate-badge.sh: Connect to shields.io using SSLv3" This reverts commit 1561786f3167b23a903a4be0d35cbb065e3c10b6. --- _build/generate-badge.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh index bee3375..94e694b 100755 --- a/_build/generate-badge.sh +++ b/_build/generate-badge.sh @@ -29,13 +29,10 @@ printf 'BADGE_COLOR="%s"\n' "$BADGE_COLOR" echo # download badge from shields.io -# use SSLv3 due to a strange TLS bug in Ubuntu 12.04 LTS used by Travis CI -# see https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/861137 for details printf 'Downloading badge...\n' TMP_BADGE="$(mktemp -u)" -wget --secure-protocol=SSLv3 \ - -O "$TMP_BADGE" \ +wget -O "$TMP_BADGE" \ "https://img.shields.io/badge/$BADGE_SUBJECT-$BADGE_STATUS-$BADGE_COLOR.svg" # validate badge From f46d0b978c122bf4ba187d8661751280f574de83 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 16:33:42 +0100 Subject: [PATCH 13/17] _build/generate-badge.sh: Skip on emty file --- _build/generate-badge.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh index 94e694b..b0d021d 100755 --- a/_build/generate-badge.sh +++ b/_build/generate-badge.sh @@ -36,7 +36,7 @@ wget -O "$TMP_BADGE" \ "https://img.shields.io/badge/$BADGE_SUBJECT-$BADGE_STATUS-$BADGE_COLOR.svg" # validate badge -if [ ! -f "$TMP_BADGE" ]; then +if [ ! -f "$TMP_BADGE" ] || [ ! -s "$TMP_BADGE" ]; then printf 'Unable to generate badge; skipping...\n\n' exit 0 fi From 32ea0508cfbc3c5f178b8630e02e9e20a683e406 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 22:49:31 +0100 Subject: [PATCH 14/17] _build/github-deploy.sh: Fix exit code on conflicting remote commit --- _build/github-deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/github-deploy.sh b/_build/github-deploy.sh index bfe32b9..fe62123 100755 --- a/_build/github-deploy.sh +++ b/_build/github-deploy.sh @@ -57,7 +57,7 @@ if [ -n "$CHECK_REPO_SLUG" ] && [ -n "$CHECK_REMOTE_REF" ] && [ -n "$CHECK_LOCAL # compare source reference against the latest commit if [ "$CHECK_REMOTE_COMMIT" != "$CHECK_LOCAL_COMMIT" ]; then echo "Latest local commit '$CHECK_LOCAL_COMMIT' doesn't match latest remote commit '$CHECK_REMOTE_COMMIT'; aborting..." >&2 - exit 0 + exit 1 fi echo From 0f85f853679fa9215cde10e05bc1670c71ea6854 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 14 Jan 2016 22:57:31 +0100 Subject: [PATCH 15/17] Build scripts: Fix exit codes --- _build/deploy-phpdoc-branch.sh | 6 +++--- _build/deploy-phpdoc-release.sh | 2 +- _build/generate-badge.sh | 4 ++-- _build/github-deploy.sh | 2 -- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index 373a6e8..2066cbe 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -2,17 +2,17 @@ if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then echo "Skipping phpDoc deployment because this is not on the required runtime" - exit + exit 0 fi if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then echo "Skipping phpDoc deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy" - exit + exit 0 fi if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" - exit + exit 0 fi PHPDOC_ID="${TRAVIS_BRANCH//\//_}" diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index 02dcea9..fd21209 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -7,7 +7,7 @@ if [ "$DEPLOY_VERSION_BADGE" != "true" ]; then echo "Skipping version badge deployment because it has been disabled" fi if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] || [ "$DEPLOY_VERSION_BADGE" != "true" ]; then - [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && exit || echo + [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && exit 0 || echo fi PHPDOC_ID="${TRAVIS_BRANCH//\//_}" diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh index b0d021d..1656c97 100755 --- a/_build/generate-badge.sh +++ b/_build/generate-badge.sh @@ -37,8 +37,8 @@ wget -O "$TMP_BADGE" \ # validate badge if [ ! -f "$TMP_BADGE" ] || [ ! -s "$TMP_BADGE" ]; then - printf 'Unable to generate badge; skipping...\n\n' - exit 0 + echo "Unable to generate badge; skipping..." >&2 + exit 1 fi # MIME type image/svg+xml isn't supported at the moment diff --git a/_build/github-deploy.sh b/_build/github-deploy.sh index fe62123..3734f20 100755 --- a/_build/github-deploy.sh +++ b/_build/github-deploy.sh @@ -66,7 +66,5 @@ fi # push changes printf 'Pushing changes...\n' git push -EXIT_CODE=$? echo -exit $EXIT_CODE From 10495c2ce55284b85ee06ac678224b2300d4431c Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sat, 16 Jan 2016 00:04:40 +0100 Subject: [PATCH 16/17] _build/generate-badge.sh: Use curl instead of wget After playing around a little bit with a Ubuntu 12.04 LTS virtual machine, `curl` came in my mind... I've absolutetly no idea why `curl` works, but `wget` does not (it's an issue with OpenSSL and both use it the same way...), but anyway - it works --- _build/generate-badge.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/generate-badge.sh b/_build/generate-badge.sh index 1656c97..5727e74 100755 --- a/_build/generate-badge.sh +++ b/_build/generate-badge.sh @@ -32,7 +32,7 @@ echo printf 'Downloading badge...\n' TMP_BADGE="$(mktemp -u)" -wget -O "$TMP_BADGE" \ +curl --location --output "$TMP_BADGE" \ "https://img.shields.io/badge/$BADGE_SUBJECT-$BADGE_STATUS-$BADGE_COLOR.svg" # validate badge From ce84a8618ca3d80bc69ef8e90e67b63348f080c4 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sun, 17 Jan 2016 21:26:06 +0100 Subject: [PATCH 17/17] Build system: Minor code refactoring --- .gitignore | 8 ++++---- _build/deploy-phpdoc-branch.sh | 30 +++++++++++++++--------------- _build/deploy-phpdoc-release.sh | 22 +++++++++++----------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 9be633f..673e405 100644 --- a/.gitignore +++ b/.gitignore @@ -15,10 +15,10 @@ desktop.ini /composer.phar /vendor -# phpDocumentor -/_build/phpdoc/ -/_build/phpdoc.cache/ -/_build/phpdoc-*/ +# Build system +/_build/phpdoc +/_build/phpdoc.cache +/_build/deploy-*.git # User config /config/config.php diff --git a/_build/deploy-phpdoc-branch.sh b/_build/deploy-phpdoc-branch.sh index 2066cbe..c4a94a9 100755 --- a/_build/deploy-phpdoc-branch.sh +++ b/_build/deploy-phpdoc-branch.sh @@ -1,29 +1,29 @@ #!/usr/bin/env bash if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then - echo "Skipping phpDoc deployment because this is not on the required runtime" - exit 0 -fi - -if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then - echo "Skipping phpDoc deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy" + echo "Skipping branch deployment because this is not on the required runtime" exit 0 fi if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" + echo "Skipping branch deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" exit 0 fi -PHPDOC_ID="${TRAVIS_BRANCH//\//_}" -PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git" +if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then + echo "Skipping phpDoc branch deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy" + exit 0 +fi + +DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}" +DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" # clone repo echo "Cloning repo..." -git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$PHPDOC_GIT_DIR" +git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$DEPLOYMENT_DIR" [ $? -eq 0 ] || exit 1 -cd "$PHPDOC_GIT_DIR" +cd "$DEPLOYMENT_DIR" echo # setup repo @@ -32,17 +32,17 @@ github-setup.sh # generate phpDocs generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ - "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" \ + "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" [ $? -eq 0 ] || exit 1 -[ -n "$(git status --porcelain "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache")" ] || exit 0 +[ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache")" ] || exit 0 # commit phpDocs echo "Committing changes..." -git add "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" +git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" git commit \ --message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \ - "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" + "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" [ $? -eq 0 ] || exit 1 echo diff --git a/_build/deploy-phpdoc-release.sh b/_build/deploy-phpdoc-release.sh index fd21209..42f11e2 100755 --- a/_build/deploy-phpdoc-release.sh +++ b/_build/deploy-phpdoc-release.sh @@ -10,15 +10,15 @@ if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] || [ "$DEPLOY_VERSION_BADGE" != "true [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && exit 0 || echo fi -PHPDOC_ID="${TRAVIS_BRANCH//\//_}" -GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git" +DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}" +DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" # clone repo echo "Cloning repo..." -git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$GIT_DIR" +git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$DEPLOYMENT_DIR" [ $? -eq 0 ] || exit 1 -cd "$GIT_DIR" +cd "$DEPLOYMENT_DIR" echo # setup repo @@ -28,17 +28,17 @@ github-setup.sh if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR/.phpdoc.xml" \ - "-" "$GIT_DIR/phpDoc/$PHPDOC_ID" \ + "-" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ "Pico 1.0 API Documentation ($TRAVIS_TAG)" [ $? -eq 0 ] || exit 1 # commit phpDocs - if [ -n "$(git status --porcelain "$GIT_DIR/phpDoc/$PHPDOC_ID")" ]; then + if [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID")" ]; then echo "Committing phpDoc changes..." - git add "$GIT_DIR/phpDoc/$PHPDOC_ID" + git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" git commit \ --message="Update phpDocumentor class docs for $TRAVIS_TAG" \ - "$GIT_DIR/phpDoc/$PHPDOC_ID" + "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" [ $? -eq 0 ] || exit 1 echo fi @@ -47,15 +47,15 @@ fi # update version badge if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then generate-badge.sh \ - "$GIT_DIR/badges/pico-version.svg" \ + "$DEPLOYMENT_DIR/badges/pico-version.svg" \ "release" "$TRAVIS_TAG" "blue" # commit version badge echo "Committing changes..." - git add "$GIT_DIR/badges/pico-version.svg" + git add "$DEPLOYMENT_DIR/badges/pico-version.svg" git commit \ --message="Update version badge for $TRAVIS_TAG" \ - "$GIT_DIR/badges/pico-version.svg" + "$DEPLOYMENT_DIR/badges/pico-version.svg" [ $? -eq 0 ] || exit 1 echo fi