From 74c31f7c0f54cffbd681e04d87fec45cb07090bf Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 17 May 2022 18:36:31 +0200 Subject: [PATCH] Update docs CI workflows to sync with new rgbds-www repo --- .github/actions/doc_postproc.awk | 56 ------------ .github/actions/get-pages.sh | 106 ---------------------- .github/workflows/create-release-docs.yml | 10 +- .github/workflows/update-master-docs.yml | 11 +-- 4 files changed, 10 insertions(+), 173 deletions(-) delete mode 100755 .github/actions/doc_postproc.awk delete mode 100755 .github/actions/get-pages.sh diff --git a/.github/actions/doc_postproc.awk b/.github/actions/doc_postproc.awk deleted file mode 100755 index 19f34bc3..00000000 --- a/.github/actions/doc_postproc.awk +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/awk -f - -/^\s+.+<\/b><\/td>$/ { - # Assuming that all cells whose contents are bold are heading cells, - # use the HTML tag for those - sub(/td><\/td/, "th"); -} - -# The whole page is being generated, so it's not meant to contain any Liquid -BEGIN { - print "{% raw %}" -} -END { - print "{% endraw %}" -} - -BEGIN { - in_synopsis = 0 -} -// { - in_synopsis = 1 -} -/<\/table>/ { - # Resets synopsis state even when already reset, but whatever - in_synopsis = 0 -} -/-[a-zA-Z]/ { - # Add links to arg descr in synopsis section - if (in_synopsis) { - while (match($0, /-[a-zA-Z]+/)) { - # 123456789012345678 -> 18 chars - optchars = substr($0, RSTART + 18, RLENGTH - 18) - i = length(optchars) - while (i) { - end = RSTART + 18 + i - i -= 1 - len = i ? 1 : 2 - $0 = sprintf("%s%s%s", - substr($0, 0, end - len - 1), - substr($0, end - 1, 1), - substr($0, end - len, len), - substr($0, end)) - } - } - } -} - -{ - # Make long opts (defined using `Fl Fl`) into a single tag - gsub(/-<\/code>\s*/, "-") -} - -{ - print -} diff --git a/.github/actions/get-pages.sh b/.github/actions/get-pages.sh deleted file mode 100755 index b48609ec..00000000 --- a/.github/actions/get-pages.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -usage() { - cat < -Copy renders from RGBDS repository to rgbds-www documentation -Execute from the \`man/\` folder in the RGBDS repo, checked out at the desired tag - : 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 and add a new entry to the index - (use for releases, not master) -EOF -} - -is_release=0 -bad_usage=0 -while getopts ":hr" opt; do - case $opt in - r) - is_release=1 - ;; - h) - usage - exit 0 - ;; - \?) - echo "Unknown option '$OPTARG'" - bad_usage=1 - ;; - esac -done -if [ $bad_usage -ne 0 ]; then - usage - exit 1 -fi -shift $((OPTIND - 1)) - - -declare -a PAGES -PAGES=( - rgbasm.1 - rgbasm.5 - rgblink.1 - rgblink.5 - rgbfix.1 - rgbgfx.1 - rgbds.5 - rgbds.7 - gbz80.7 -) -WWWPATH="/docs" -OUTDIR="$1/_documentation/$2" -mkdir -p "$OUTDIR" - -# `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 rest; -# this script must thus be run from the directory all man pages are in. - -for page in "${PAGES[@]}"; do -manpage="${page%.?}(${page#*.})" # "rgbasm(5)" -descr="$(awk -v 'FS=.Nd ' '/.Nd/ { print $2; }' "$page")" # "language documentation" - - cat >"$OUTDIR/$page.html" <> "$OUTDIR/$page.html" - groff -Tpdf -mdoc -wall "$page" >"$OUTDIR/$page.pdf" - if [[ $is_release -ne 0 ]]; then - cat - >"$1/_documentation/$page.html" <"$OUTDIR/index.html" <"$1/_data/doc.json.tmp" - mv "$1/_data/doc.json"{.tmp,} -fi diff --git a/.github/workflows/create-release-docs.yml b/.github/workflows/create-release-docs.yml index 90cd5998..2ed643ae 100644 --- a/.github/workflows/create-release-docs.yml +++ b/.github/workflows/create-release-docs.yml @@ -23,16 +23,16 @@ jobs: run: | sudo apt-get -qq update sudo apt-get install -yq groff zlib1g-dev - wget 'http://mandoc.bsd.lv/snapshots/mandoc-1.14.5.tar.gz' - tar xf mandoc-1.14.5.tar.gz - cd mandoc-1.14.5 + wget 'http://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz' + tar xf mandoc-1.14.6.tar.gz + cd mandoc-1.14.6 ./configure make sudo make install - name: Update pages - working-directory: rgbds + working-directory: rgbds/man run: | # The ref appears to be in the format "refs/tags/", so strip that - ./.github/actions/get-pages.sh -r ../rgbds-www ${GITHUB_REF##*/} + ../../rgbds-www/.github/actions/get-pages.sh ${GITHUB_REF##*/} * - name: Push new pages working-directory: rgbds-www run: | diff --git a/.github/workflows/update-master-docs.yml b/.github/workflows/update-master-docs.yml index a093aa85..af6f160c 100644 --- a/.github/workflows/update-master-docs.yml +++ b/.github/workflows/update-master-docs.yml @@ -4,7 +4,6 @@ on: branches: - master paths: - - .github/actions/get-pages.sh - man/gbz80.7 - man/rgbds.5 - man/rgbds.7 @@ -36,16 +35,16 @@ jobs: run: | sudo apt-get -qq update sudo apt-get install -yq groff zlib1g-dev - wget 'http://mandoc.bsd.lv/snapshots/mandoc-1.14.5.tar.gz' - tar xf mandoc-1.14.5.tar.gz - cd mandoc-1.14.5 + wget 'http://mandoc.bsd.lv/snapshots/mandoc-1.14.6.tar.gz' + tar xf mandoc-1.14.6.tar.gz + cd mandoc-1.14.6 ./configure make sudo make install - name: Update pages working-directory: rgbds/man run: | - ../.github/actions/get-pages.sh ../../rgbds-www master + ../../rgbds-www/maintainer/man_to_html.sh master * - name: Push new pages working-directory: rgbds-www run: | @@ -56,7 +55,7 @@ jobs: ssh-add ~/.ssh/id_ed25519 git config --global user.name "GitHub Action" git config --global user.email "community@gbdev.io" - git add . + git add -A git commit -m "Update RGBDS master documentation" if git remote | grep -q origin; then git remote set-url origin git@github.com:gbdev/rgbds-www.git