Files
awesome-cordova-plugins/scripts/docs/update_docs.sh
T

51 lines
1.2 KiB
Bash
Raw Normal View History

2016-01-25 16:20:36 -06:00
#!/bin/bash
echo "##### "
echo "##### ci/update_docs.sh"
2016-01-25 16:20:36 -06:00
echo "#####"
function init {
cd ..
SITE_PATH=$(readJsonProp "config.json" "sitePath")
cd ..
export IONIC_DIR=$PWD
SITE_DIR=$IONIC_DIR/$SITE_PATH
}
function run {
2016-01-25 16:20:36 -06:00
VERSION=$(readJsonProp "package.json" "version")
# process new docs
2016-03-15 17:43:59 -05:00
./node_modules/.bin/gulp docs
2016-01-25 16:20:36 -06:00
# CD in to the site dir to commit updated docs
cd $SITE_DIR
2017-03-22 22:40:02 -04:00
# Add all files to git
git add .
2016-01-25 16:20:36 -06:00
# if no changes, don't commit
2017-03-22 22:40:02 -04:00
CHANGED=$(git diff-index --name-only HEAD 2>/dev/null | wc -l)
if [ $CHANGED -gt 0 ];
2016-12-05 16:45:47 -06:00
then
echo "-- No changes detected for the following commit, docs not updated."
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
2016-01-25 16:20:36 -06:00
else
2016-05-09 11:36:38 -05:00
git config --global user.email "hi@ionicframework.com"
git config --global user.name "Ionitron"
2016-03-31 13:24:25 -05:00
git commit -am "Automated build of native docs driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
# 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-05 16:50:31 -06:00
git push origin master || :
2016-01-25 16:20:36 -06:00
echo "-- Updated docs for $VERSION_NAME succesfully!"
fi
}
source $(dirname $0)/../utils.inc.sh