From 22c7dfe0e13864c447fc64ae990c0f2dbb335064 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Sat, 22 Aug 2026 14:23:13 +0300 Subject: [PATCH] Generate HTML documentation from man pages in a workflow The HTML under doc/html was produced by a script kept outside this repository, so editing a man page and refreshing its HTML were separate manual steps and the two could drift apart. Run the same groff conversion in a workflow triggered by a change under man/. It rebuilds doc/html/index.html and the man5 and man8 pages, and commits only when something actually changed. Output was verified byte for byte against the committed tree: all twelve man pages and index.html are reproduced exactly. --- .github/workflows/update-docs.yml | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/update-docs.yml diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml new file mode 100644 index 0000000..c3569a2 --- /dev/null +++ b/.github/workflows/update-docs.yml @@ -0,0 +1,51 @@ +name: Update HTML documentation + +on: + push: + paths: + - 'man/**' + workflow_dispatch: + +permissions: + contents: read + +jobs: + docs: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Install groff + run: | + sudo apt-get update + sudo apt-get install -y groff + + - name: Generate HTML from man pages + run: | + mkdir -p doc/html/man5 doc/html/man8 + echo \\3proxy documentation\\\3proxy documentation\ >doc/html/index.html + echo \Security recommendations\\ >>doc/html/index.html + echo \Optimizing 3proxy for high loads\\ >>doc/html/index.html + echo \How To \(English, very incomplete\)\\ >>doc/html/index.html + echo \How To \(Russian\)\\ >>doc/html/index.html + echo \Developer reference\\ >>doc/html/index.html + echo \Man pages:\ >>doc/html/index.html + cd man + for i in *.8; do ((bash -c "groff -mandoc -Thtml $i | grep -v DOCTYPE| grep -v text/css| grep -v 'meta ' | grep -v /style | grep -v { | grep -v /title | grep -v www.w3.org | grep -v CreationDate" > ../doc/html/man8/$i.html ) && echo \\$i\ >> ../doc/html/index.html); done + for i in *.5; do ((bash -c "groff -mandoc -Thtml $i | grep -v DOCTYPE| grep -v text/css| grep -v 'meta ' | grep -v /style | grep -v { | grep -v /title | grep -v www.w3.org | grep -v CreationDate" > ../doc/html/man5/$i.html ) && echo \\$i\ >> ../doc/html/index.html); done + cd .. + echo \\ >>doc/html/index.html + + - name: Commit + run: | + if [ -z "$(git status --porcelain doc/html)" ]; then + echo "documentation already up to date" + exit 0 + fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add doc/html + git commit -m "Update HTML documentation from man pages" + git push