From 8fc1bf4bc12291d3af1a95d61a8cfe1694b651a1 Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Thu, 23 Nov 2017 09:55:16 -0800 Subject: [PATCH] script to update and copy hugo site --- hack/update-docs.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 hack/update-docs.sh diff --git a/hack/update-docs.sh b/hack/update-docs.sh new file mode 100755 index 00000000..6a2a5b5e --- /dev/null +++ b/hack/update-docs.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +set -x +set -euo pipefail + +DIR=$(realpath $(dirname $0))/../ +BUILDDIR=$(realpath $DIR)/build +DOCS_SITE=$DIR/Documentation/docs-site + +check_hugo() { + if ! which hugo + then + echo "Can't find hugo. Go here to learn how to install it: https://gohugo.io/getting-started/installing/" + exit 1 + fi +} + +generate_hugo_docs() { + pushd $DOCS_SITE + + hugo -t docdock + + popd +} + +check_website_root() { + website_root=$1 + pushd $website_root + # xxx ensure we're in the fission.io repo + popd +} + +copy_hugo_docs() { + version=$1 + website_root=$2 + + check_website_root $website_root + pushd $website_root + + mkdir -p docs/$version + cp -r $DOCS_SITE/public/* docs/$version + git add docs/$version + + pushd docs + rm latest + ln -s $version latest + git add latest + popd + + popd +} + +main() { + version=$1 + website_root=$2 + + check_hugo + generate_hugo_docs + copy_hugo_docs $version $website_root +} + +version=$1 +website_root=$2 +main $version $website_root +