2015-07-21 21:34:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Script to build and deploy docs to github pages.
|
|
|
|
|
2015-07-24 23:41:10 +00:00
|
|
|
# Any Content currently visible on the website will be replaced by
|
2015-07-21 21:34:40 +00:00
|
|
|
# this process.
|
|
|
|
|
|
|
|
OUTPUT_DIRECTORY="docs"
|
2015-07-24 23:41:10 +00:00
|
|
|
REPOSITORY_URL="git@github.com:nasa/openmctweb.git"
|
2015-07-21 21:34:40 +00:00
|
|
|
|
|
|
|
BUILD_SHA=`git rev-parse head`
|
|
|
|
|
|
|
|
# A remote will be created for the git repository we are pushing to.
|
|
|
|
# Don't change the name.
|
|
|
|
REMOTE_NAME="documentation"
|
|
|
|
WEBSITE_BRANCH="gh-pages"
|
|
|
|
|
|
|
|
# Configure github for CircleCI user.
|
2015-07-25 00:07:49 +00:00
|
|
|
git config user.email "buildbot@circleci.com"
|
|
|
|
git config user.name "BuildBot"
|
2015-07-21 21:34:40 +00:00
|
|
|
|
|
|
|
# clean output directory
|
|
|
|
if [ -d $OUTPUT_DIRECTORY ]; then
|
|
|
|
rm -rf $OUTPUT_DIRECTORY || exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
npm run-script jsdoc
|
|
|
|
cd $OUTPUT_DIRECTORY || exit 1
|
|
|
|
|
|
|
|
echo "git init"
|
|
|
|
git init
|
|
|
|
echo "git remote add $REMOTE_NAME $REPOSITORY_URL"
|
|
|
|
git remote add $REMOTE_NAME $REPOSITORY_URL
|
|
|
|
echo "git add ."
|
|
|
|
git add .
|
|
|
|
echo "git commit -m \"Generate docs from build $BUILD_SHA\""
|
|
|
|
git commit -m "Generate docs from build $BUILD_SHA"
|
|
|
|
|
|
|
|
echo "git push $REMOTE_NAME HEAD:$WEBSITE_BRANCH -f"
|
|
|
|
git push $REMOTE_NAME HEAD:$WEBSITE_BRANCH -f
|
|
|
|
|
2015-07-25 00:07:49 +00:00
|
|
|
echo "Documentation pushed to gh-pages branch."
|