2016-01-26 06:20:36 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo "##### "
|
|
|
|
echo "##### ci/deploy.sh"
|
|
|
|
echo "#####"
|
|
|
|
|
|
|
|
|
|
|
|
function init {
|
|
|
|
cd ..
|
|
|
|
SITE_PATH=$(readJsonProp "config.json" "sitePath")
|
|
|
|
cd ..
|
|
|
|
export IONIC_DIR=$PWD
|
|
|
|
SITE_DIR=$IONIC_DIR/$SITE_PATH
|
|
|
|
}
|
|
|
|
|
|
|
|
function run {
|
2016-03-16 06:36:59 +08:00
|
|
|
|
2016-01-26 06:20:36 +08:00
|
|
|
VERSION=$(readJsonProp "package.json" "version")
|
|
|
|
|
|
|
|
# process new docs
|
2016-03-16 06:43:59 +08:00
|
|
|
./node_modules/.bin/gulp docs
|
2016-01-26 06:20:36 +08:00
|
|
|
|
|
|
|
# CD in to the site dir to commit updated docs
|
|
|
|
cd $SITE_DIR
|
|
|
|
|
|
|
|
# if no changes, don't commit
|
2016-12-17 04:59:11 +08:00
|
|
|
CHANGED=$(git diff-index --name-only HEAD --)
|
|
|
|
if [ -z "$CHANGED" ];
|
2016-12-06 06:45:47 +08:00
|
|
|
then
|
2016-03-16 05:05:05 +08:00
|
|
|
echo "-- No changes detected for the following commit, docs not updated."
|
|
|
|
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
2016-01-26 06:20:36 +08:00
|
|
|
else
|
2016-05-10 00:36:38 +08:00
|
|
|
git config --global user.email "hi@ionicframework.com"
|
|
|
|
git config --global user.name "Ionitron"
|
2016-01-26 06:20:36 +08:00
|
|
|
git add -A
|
2016-04-01 02:24:25 +08:00
|
|
|
git commit -am "Automated build of native docs driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
|
2016-05-06 03:50:40 +08:00
|
|
|
# in case a different commit was pushed to ionic-site during doc/demo gen,
|
|
|
|
# try to rebase around it before pushing
|
|
|
|
git fetch
|
|
|
|
git rebase
|
|
|
|
|
2016-12-06 06:50:31 +08:00
|
|
|
git push origin master || :
|
2016-01-26 06:20:36 +08:00
|
|
|
|
|
|
|
echo "-- Updated docs for $VERSION_NAME succesfully!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-03-16 06:36:59 +08:00
|
|
|
source $(dirname $0)/../utils.inc.sh
|