From f0d67fe873b02c663a1ea925dc305f7db8303d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Thu, 4 Sep 2014 15:41:15 -0700 Subject: [PATCH] deploy api docs --- docs/_bin/deploy-docs.sh | 47 ++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/docs/_bin/deploy-docs.sh b/docs/_bin/deploy-docs.sh index 592ab4ff378..46429d76415 100755 --- a/docs/_bin/deploy-docs.sh +++ b/docs/_bin/deploy-docs.sh @@ -1,4 +1,4 @@ -#! /bin/bash -e +#!/bin/bash -e if [ -z "$1" ]; then version="latest" @@ -6,50 +6,65 @@ else version=$1 fi -docs=$(git -C "$(dirname "$0")" rev-parse --show-toplevel)/docs +druid=$(git -C "$(dirname "$0")" rev-parse --show-toplevel) -if [ -n "$(git -C "$docs" status --porcelain --untracked-files=no content)" ]; then - echo "Docs directory is not clean, aborting" +if [ -n "$(git -C "$druid" status --porcelain --untracked-files=no)" ]; then + echo "Working directory is not clean, aborting" exit 1 fi -if [ -z "$(git tag -l "druid-$version")" ] && [ "$version" != "latest" ]; then +branch=druid-$version +if [ "$version" == "latest" ]; then + branch=master +fi + +if [ -z "$(git tag -l "$branch")" ] && [ "$branch" != "master" ]; then echo "Version tag does not exist: druid-$version" exit 1; fi tmp=$(mktemp -d -t druid-docs-deploy) +target=$tmp/docs +src=$tmp/druid echo "Using Version [$version]" echo "Working directory [$tmp]" -git clone git@github.com:druid-io/druid-io.github.io.git "$tmp" +git clone -q --depth 1 git@github.com:druid-io/druid-io.github.io.git "$target" -target=$tmp/docs/$version +remote=$(git -C "$druid" config --local --get remote.origin.url) +git clone -q --depth 1 --branch $branch $remote "$src" -mkdir -p $target -rsync -a --delete "$docs/content/" $target +mkdir -p $target/docs/$version +rsync -a --delete "$src/docs/content/" $target/docs/$version -branch=update-docs-$version +# generate javadocs for releases (not for master) +if [ "$version" != "latest" ] ; then + (cd $src && mvn javadoc:aggregate) + mkdir -p $target/api/$version + rsync -a --delete "$src/target/site/apidocs/" $target/api/$version +fi -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 +updatebranch=update-docs-$version + +git -C $target checkout -b $updatebranch +git -C $target add -A . +git -C $target commit -m "Update $version docs" +git -C $target push origin $updatebranch if [ -n "$GIT_TOKEN" ]; then curl -u "$GIT_TOKEN:x-oauth-basic" -XPOST -d@- \ https://api.github.com/repos/druid-io/druid-io.github.io/pulls <