From bf2a9622db3c35b94eceaeb32d9e919dd18f36bf Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 12:04:08 -0600 Subject: [PATCH] Update deploy script * [Changed] move everything inside /build/ directory * [Changed] use absolute file paths in script * [Changed] copy docs to both the release number and master dirs Implement @PhrozenByte 's suggestions. * [Changed] use `$GITHUB_OAUTH_TOKEN` instead of `$GITHUB_TOKEN` --- build/deploy-phpdoc.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 build/deploy-phpdoc.sh diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh new file mode 100644 index 0000000..921fc7b --- /dev/null +++ b/build/deploy-phpdoc.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Modified from: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd + +# Exit with nonzero exit code if anything fails +set -e + +# Clone Pico, then create & checkout gh-pages branch +git clone -b gh-pages "https://github.com/picocms/Pico.git $TRAVIS_BUILD_DIR/build/Pico" + +# Inside this git repo we'll pretend to be a new user +git config user.name "Travis CI" +git config user.email "travis-ci@picocms.org" + +#copy new files to release number +cp -a $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/pico-$TRAVIS_TAG +#move old files +mv -f $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master $TRAVIS_BUILD_DIR/build/Pico/phpDoc/old-stable +#copy new files to master +cp -a $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master + +# Add the files to our commit +git add $TRAVIS_BUILD_DIR/build/Pico/phpDoc/* + +# Commit the files with our commit message +git commit -m "Update Documentation for Pico $TRAVIS_TAG" + +# Force push from the current repo's master branch to the remote +# repo's gh-pages branch.We redirect any output to +# /dev/null to hide any sensitive credential data that might otherwise be exposed. +git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1