mirror of https://github.com/apache/druid.git
add option to generate only api or only docs
This commit is contained in:
parent
963a44a8d4
commit
280681e84b
|
@ -1,5 +1,24 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
opt_api=1
|
||||||
|
while getopts ":adn" opt; do
|
||||||
|
case $opt in
|
||||||
|
n)
|
||||||
|
opt_dryrun="1"
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
opt_api=
|
||||||
|
;;
|
||||||
|
a)
|
||||||
|
opt_docs=
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
version="latest"
|
version="latest"
|
||||||
else
|
else
|
||||||
|
@ -35,11 +54,13 @@ git clone -q --depth 1 git@github.com:druid-io/druid-io.github.io.git "$target"
|
||||||
remote=$(git -C "$druid" config --local --get remote.origin.url)
|
remote=$(git -C "$druid" config --local --get remote.origin.url)
|
||||||
git clone -q --depth 1 --branch $branch $remote "$src"
|
git clone -q --depth 1 --branch $branch $remote "$src"
|
||||||
|
|
||||||
mkdir -p $target/docs/$version
|
if [ -n "$opt_docs" ] ; then
|
||||||
rsync -a --delete "$src/docs/content/" $target/docs/$version
|
mkdir -p $target/docs/$version
|
||||||
|
rsync -a --delete "$src/docs/content/" $target/docs/$version
|
||||||
|
fi
|
||||||
|
|
||||||
# generate javadocs for releases (not for master)
|
# generate javadocs for releases (not for master)
|
||||||
if [ "$version" != "latest" ] ; then
|
if [ "$version" != "latest" ] && [ -n "$opt_api" ] ; then
|
||||||
(cd $src && mvn javadoc:aggregate)
|
(cd $src && mvn javadoc:aggregate)
|
||||||
mkdir -p $target/api/$version
|
mkdir -p $target/api/$version
|
||||||
rsync -a --delete "$src/target/site/apidocs/" $target/api/$version
|
rsync -a --delete "$src/target/site/apidocs/" $target/api/$version
|
||||||
|
@ -50,10 +71,11 @@ updatebranch=update-docs-$version
|
||||||
git -C $target checkout -b $updatebranch
|
git -C $target checkout -b $updatebranch
|
||||||
git -C $target add -A .
|
git -C $target add -A .
|
||||||
git -C $target commit -m "Update $version docs"
|
git -C $target commit -m "Update $version docs"
|
||||||
git -C $target push origin $updatebranch
|
if [ -z "$opt_dryrun" ]; then
|
||||||
|
git -C $target push origin $updatebranch
|
||||||
|
|
||||||
if [ -n "$GIT_TOKEN" ]; then
|
if [ -n "$GIT_TOKEN" ]; then
|
||||||
curl -u "$GIT_TOKEN:x-oauth-basic" -XPOST -d@- \
|
curl -u "$GIT_TOKEN:x-oauth-basic" -XPOST -d@- \
|
||||||
https://api.github.com/repos/druid-io/druid-io.github.io/pulls <<EOF
|
https://api.github.com/repos/druid-io/druid-io.github.io/pulls <<EOF
|
||||||
{
|
{
|
||||||
"title" : "Update $version docs",
|
"title" : "Update $version docs",
|
||||||
|
@ -62,9 +84,13 @@ curl -u "$GIT_TOKEN:x-oauth-basic" -XPOST -d@- \
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "GitHub personal token not provided, not submitting pull request"
|
echo "GitHub personal token not provided, not submitting pull request"
|
||||||
echo "Please go to https://github.com/druid-io/druid-io.github.io and submit a pull request from the \`$updatebranch\` branch"
|
echo "Please go to https://github.com/druid-io/druid-io.github.io and submit a pull request from the \`$updatebranch\` branch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf $tmp
|
rm -rf $tmp
|
||||||
|
else
|
||||||
|
echo "Not pushing. To see changes run:"
|
||||||
|
echo "git -C $target diff HEAD^1"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue