From dddf7a4e54d70a23c453cb8c058c4a756cd30070 Mon Sep 17 00:00:00 2001 From: Lourival Vieira Neto Date: Sun, 22 Nov 2026 18:07:53 -0300 Subject: [PATCH] doc: the site names its release and serves master apart The site's pages named no release, so the header of every page read "master" over the v0.1 docs, since Lunatik's template takes the release a page belongs to from doc/.tags and the releases the site serves from doc/.releases, and lists master beside them. A release now builds the root with its tag in both, and a push to master builds master/ beside it, naming the latest release, so the header's link to master and master's link back to the release land, as on Lunatik's site. A dispatch rebuilds the root from master under the latest release's name: v0.1's tree has no config.ld, which came after it. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/doc.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 263bc6a..3569ac5 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -32,19 +32,36 @@ jobs: # LDoc runs on lua5.4, the newest Lua the archive builds it for, and discount, which the archive dropped, comes from luarocks for that Lua bash harness/tools/retry.sh 5 90 sudo sh -c 'apt-get update && apt-get install -y lua5.5 lua5.4 lua-ldoc luarocks liblua5.4-dev libmarkdown2-dev' bash harness/tools/retry.sh 5 90 sudo luarocks --lua-version=5.4 install discount DISCOUNT_INCDIR=/usr/include/$(gcc -print-multiarch) DISCOUNT_LIBDIR=/usr/lib/$(gcc -print-multiarch) + - name: Name the release the site serves + env: + GH_TOKEN: ${{ github.token }} + run: echo "RELEASE=$(gh api repos/${{ github.repository }}/releases/latest --jq .tag_name || true)" >> "$GITHUB_ENV" - name: Build docs run: | - # the template reads the release a page belongs to and the releases the site serves; this site serves one, unlisted - : > doc/.tags - : > doc/.releases + # the template reads the release a page belongs to and the releases the site serves: the root's pages + # name the latest release, and master's, under master/, name none + case "${{ github.event_name }}" in + release|workflow_dispatch) echo "$RELEASE" > doc/.tags ;; + *) : > doc/.tags ;; + esac + echo "$RELEASE" > doc/.releases ldoc . cp .lunatik/doc/style/site.js site/ cp -r .lunatik/doc/style/fonts site/ lua5.5 .lunatik/doc/style/search.lua site - - name: Deploy - # the site shows the latest release, so a push to master builds it and deploys nothing + - name: Deploy the release + # a dispatch rebuilds the root from master, for v0.1, whose tree has no config.ld if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }} uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: site + keep_files: true + - name: Deploy master + if: ${{ github.event_name == 'push' }} + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site + destination_dir: master + keep_files: true