diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..902a7b1 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,44 @@ +name: Publish documentation + +on: + push: + branches: [ master ] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build: + name: Build website + runs-on: ubuntu-latest + steps: + - name: Prepare + run: | + sudo apt-get update + sudo apt-get install -y pandoc + - name: Check out + uses: actions/checkout@v4 + - name: Build website + run: ./doc/build-website.sh _site + - name: Upload website + uses: actions/upload-pages-artifact@v3 + with: + path: _site + deploy: + name: Deploy to GitHub Pages + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 diff --git a/doc/build-website.sh b/doc/build-website.sh new file mode 100755 index 0000000..345b7f1 --- /dev/null +++ b/doc/build-website.sh @@ -0,0 +1,79 @@ +#! /bin/sh +# +# Assembles the documentation website published via GitHub Pages. +# Requires pandoc, which is used to convert README.md to HTML. +# +# Usage: doc/build-website.sh [output-directory] +# + +set -e + +srcdir=`dirname "$0"` +outdir=${1:-_site} + +if ! command -v pandoc > /dev/null 2>&1; then + echo "error: pandoc is required to build the website" >&2 + exit 1 +fi + +mkdir -p "$outdir" +cp "$srcdir/default.css" "$outdir" + +# The HTML files in doc/ are body fragments with no or
; +# they were originally embedded in a site template. This wraps a +# fragment (read from stdin) into a complete page. +emit_page() { + title=$1 + out=$2 + + { + cat << EOF + + + + + +