From 70f46dfb62278df9f6820b0cfdff561d084eb199 Mon Sep 17 00:00:00 2001 From: Ondrej Nosek Date: Fri, 4 Jan 2019 13:32:17 +0100 Subject: [PATCH] Unify update-docs.sh script with rpkg Signed-off-by: Ondrej Nosek --- doc/update-docs.sh | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/doc/update-docs.sh b/doc/update-docs.sh index 7efcb33e..11fb2858 100755 --- a/doc/update-docs.sh +++ b/doc/update-docs.sh @@ -3,26 +3,38 @@ # Copyright (C) 2015 Red Hat, Inc. # SPDX-License-Identifier: GPL-2.0 -set -e +trap cleanup EXIT -git clone https://pagure.io/pungi.git /tmp/pungi -pushd /tmp/pungi/doc +function cleanup() { + printf "Run cleanup\\n" + rm -rf "$dir_pungi" "$dir_pungi_doc" +} + +if [ -z "$1" ]; then + printf "Usage:\\n" + printf "\\t%s release_version\\n" "$0" + exit 1 +fi + +set -e +dir_pungi=$(mktemp -d /tmp/pungi.XXX) || { echo "Failed to create temp directory"; exit 1; } +git clone https://pagure.io/pungi.git "$dir_pungi" +pushd "$dir_pungi"/doc make html popd -git clone ssh://git@pagure.io/docs/pungi.git /tmp/pungi-doc -pushd /tmp/pungi-doc +dir_pungi_doc=$(mktemp -d /tmp/pungi-doc.XXX) || { echo "Failed to create temp directory"; exit 1; } +git clone ssh://git@pagure.io/docs/pungi.git "$dir_pungi_doc" +pushd "$dir_pungi_doc" git rm -fr ./* -cp -r /tmp/pungi/doc/_build/html/* ./ -pushd /tmp/pungi/doc +cp -r "$dir_pungi"/doc/_build/html/* ./ +pushd "$dir_pungi"/doc git checkout 4.0.x make html popd mkdir 4.0 -cp -r /tmp/pungi/doc/_build/html/* ./4.0/ +cp -r "$dir_pungi"/doc/_build/html/* ./4.0/ git add . -git commit -s -m "update rendered pungi docs" +git commit -s -m "update rendered pungi docs for release $1" git push origin master popd - -rm -rf /tmp/pungi/ /tmp/pungi-doc/