From e9d9a44687c94c1036601f72a5ea0fc15a9aad5c Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 9 Mar 2021 19:59:28 +0100 Subject: [PATCH] Make release doc update also register docs --- .github/actions/get-pages.sh | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/actions/get-pages.sh b/.github/actions/get-pages.sh index 8e4ac714..11f552f6 100755 --- a/.github/actions/get-pages.sh +++ b/.github/actions/get-pages.sh @@ -5,20 +5,21 @@ usage() { Usage: $0 [-h] [-r] Copy renders from RGBDS repository to rgbds-www documentation Execute from the root folder of the RGBDS repo, checked out at the desired tag - : Path to the '_documentation' folder in the rgbds-www repository + : Path to the rgbds-www repository : Version to be copied, such as 'v0.4.1' or 'master' -h Display this help message - -r Update "latest stable" redirection pages (use for releases, not master) + -r Update "latest stable" redirection pages and add a new entry to the index + (use for releases, not master) EOF } -update_redirects=0 +is_release=0 bad_usage=0 while getopts ":hr" opt; do case $opt in r) - update_redirects=1 + is_release=1 ;; h) usage @@ -50,7 +51,7 @@ PAGES=( [gbz80.7.html]=src/gbz80.7 ) WWWPATH="/docs" -mkdir -p "$1/$2" +mkdir -p "$1/_documentation/$2" # `mandoc` uses a different format for referring to man pages present in the **current** directory # We want that format for RGBDS man pages, and the other one for the t=rest; @@ -64,7 +65,7 @@ stem="${page%.html}" manpage="${stem%.?}(${stem#*.})" descr="$(awk -v 'FS=.Nd ' '/.Nd/ { print $2; }' "${PAGES[$page]}")" - cat >"$1/$2/$page" <"$1/_documentation/$2/$page" <> "$1/$2/$page" - if [ $update_redirects -ne 0 ]; then - cat - >"$1/$page" <> "$1/_documentation/$2/$page" + if [ $is_release -ne 0 ]; then + cat - >"$1/_documentation/$page" <"$1/$2/index.html" <"$1/_documentation/$2/index.html" <"$1/_data/doc.json.tmp" + mv "$1/_data/doc.json"{.tmp,} +fi + # Clean up rm "${PAGES[@]##*/}"