better updatedoc.sh

This commit is contained in:
Stepan Koltsov
2012-03-02 04:19:56 +04:00
parent 654c05d68c
commit 57531751dd
+22 -10
View File
@@ -1,19 +1,31 @@
#!/bin/sh
#!/bin/sh -e
# generates the API docs and uploads them to github pages
# for help on github pages see: http://pages.github.com/
ec() {
echo "$@" >&2
"$@"
}
ec cd $(dirname $0)
# TODO can we fail the build if the docs are not created?
ant doc || exit $?
ec ant doc
echo "Cloning/pulling latest gh-pages branch"
git clone -b gh-pages git@github.com:JetBrains/kotlin.git gh-pages
cd gh-pages
git pull || exit $?
rm -rf apidoc/stdlib/*
cp -r ../dist/apidoc/* apidoc
git add apidoc || exit $?
git commit -m "latest apidocs" || exit $?
git push || exit $?
if [ ! -e gh-pages ]; then
ec git clone -b gh-pages git@github.com:JetBrains/kotlin.git gh-pages
ec cd gh-pages
else
ec cd gh-pages
ec git checkout gh-pages
ec git pull --rebase
fi
ec git rm -r apidoc
ec cp -r ../dist/apidoc apidoc
ec git add apidoc
ec git commit -m "latest apidocs"
ec git push
echo "Updated github pages for apidocs"