parent
e79388118c
commit
7f4ad75245
@ -1,29 +1,29 @@ |
|||||||
#!/usr/bin/env bash |
#!/usr/bin/env bash |
||||||
# Modified from: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd |
|
||||||
|
|
||||||
# Exit with nonzero exit code if anything fails |
|
||||||
set -e |
set -e |
||||||
|
|
||||||
# Clone Pico, then create & checkout gh-pages branch |
# parameters |
||||||
git clone -b gh-pages "https://github.com/picocms/Pico.git $TRAVIS_BUILD_DIR/build/Pico" |
GITHUB_PROJECT="$1" # GitHub repo (e.g. picocms/Pico) |
||||||
|
GITHUB_BRANCH="$2" # branch to use (e.g. gh-pages) |
||||||
|
GITHUB_OAUTH_TOKEN="$3" # see https://github.com/settings/tokens |
||||||
|
SOURCE_DIR="$4" # absolute path to phpDocs target directory |
||||||
|
TARGET_DIR="$5" # relative path within the specified GitHub repo |
||||||
|
|
||||||
|
# clone repo |
||||||
|
GIT_DIR="$(dirname "$0")/$(basename "$SOURCE_DIR").git" |
||||||
|
git clone -b "$GITHUB_BRANCH" "https://github.com/$GITHUB_PROJECT.git" "$GIT_DIR" |
||||||
|
|
||||||
# Inside this git repo we'll pretend to be a new user |
# setup git |
||||||
|
cd "$GIT_DIR" |
||||||
git config user.name "Travis CI" |
git config user.name "Travis CI" |
||||||
git config user.email "travis-ci@picocms.org" |
git config user.email "travis-ci@picocms.org" |
||||||
|
|
||||||
#copy new files to release number |
# copy phpdoc |
||||||
cp -a $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/$TRAVIS_TAG |
[ -e "$TARGET_DIR" ] && echo "FATAL: $(basename "$0") target directory exists" && exit 1 |
||||||
#move old master files to old-stable |
cp -R "$SOURCE_DIR" "$TARGET_DIR" |
||||||
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/$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 |
# commit changes |
||||||
git commit -m "Update Documentation for Pico $TRAVIS_TAG" |
git add "$TARGET_DIR" |
||||||
|
git commit -m "Add phpDocumentor class docs for Pico $TRAVIS_TAG" |
||||||
|
|
||||||
# Force push from the current repo's gh-pages branch to the remote repo's gh-pages branch. |
# push changes |
||||||
# We redirect output to /dev/null to hide any sensitive data that might otherwise be exposed. |
git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@github.com/$GITHUB_PROJECT.git" "$GITHUB_BRANCH:$GITHUB_BRANCH" > /dev/null 2>&1 |
||||||
git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@github.com/picocms/Pico.git" master:gh-pages > /dev/null 2>&1 |
|
||||||
|
Loading…
Reference in new issue