2013-09-27 21:50:02 -04:00
|
|
|
#! /bin/bash -e
|
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
if [ -z "$1" ]; then
|
|
|
|
version="latest"
|
2013-09-27 21:50:02 -04:00
|
|
|
else
|
2014-08-01 18:12:00 -04:00
|
|
|
version=$1
|
2013-09-27 21:50:02 -04:00
|
|
|
fi
|
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
if [ -z "$(git tag -l "druid-$version")" ] && [ "$version" != "latest" ]; then
|
|
|
|
echo "Version tag does not exist: druid-$version"
|
2013-11-05 18:20:55 -05:00
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
tmp=$(mktemp -d -t druid-docs-deploy)
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
echo "Using Version [$version]"
|
|
|
|
echo "Working directory [$tmp]"
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
git clone https://github.com/druid-io/druid-io.github.io.git "$tmp"
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
docs=$(git -C$(dirname "$0") rev-parse --show-toplevel)/docs
|
|
|
|
target=$tmp/docs/$version
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
mkdir -p $target
|
|
|
|
rsync -a --delete "$docs/content/" $target
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
branch=update-docs-$version
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
git -C $tmp checkout -b $branch
|
|
|
|
git -C $tmp add -A .
|
|
|
|
#git -C $tmp commit -m "Update $version docs"
|
|
|
|
#git -C $tmp push origin $branch
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
if [ -n "$GIT_TOKEN" ]; then
|
|
|
|
curl -u "$GIT_TOKEN:x-oauth-basic" \
|
|
|
|
-XPOST https://api.github.com/repos/druid-io/druid-io.github.io/pulls -d<<EOF
|
|
|
|
{
|
|
|
|
"title" : "Update docs `$version`",
|
|
|
|
"head" : "$branch",
|
|
|
|
"base" : "master"
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
else
|
|
|
|
echo "GitHub personal token not provided, not submitting pull request"
|
|
|
|
fi
|
2013-09-27 21:50:02 -04:00
|
|
|
|
2014-08-01 18:12:00 -04:00
|
|
|
#rm -rf ${tmp}
|