Skip to content
waldiezPublic

About

Documentation for waldiez.

Resources

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Repository files navigation

docs.waldiez.io

This repository assembles and deploys the documentation site for the Waldiez projects. It builds no docs itself: each project builds its own and pushes the result to a branch of its own. This repository fetches those branches, mounts each at its path, adds the landing page and deploys the lot to GitHub Pages.

a project's release => builds its docs => pushes them to its branch => notifies this repository

sites.toml => scripts/assemble.py: fetch each branch, mount it, add the landing page => GitHub Pages

.github/workflows/deploy.yml runs when a project sends a notice, once a day (so a missed notice heals by the next day), and by hand. .github/workflows/check.yml runs on every push and pull request. It runs the linters and tests, checks the workflows with zizmor, and checks the landing page built from sites.toml with axe (WCAG 2.2 AA), light and dark, wide and on a phone. It checks the 404 page too, loaded at a missing path as GitHub Pages serves it.

sites.toml

[[site]]
repo = "waldiez/wactorz"   # where the built docs are
ref = "gh-pages"           # the branch that holds them
mount = "/wactorz/"        # where they are served
# path = "schema"          # optional: mount one folder of the branch instead of all of it
title = "Wactorz"          # title and summary: a card on the landing page (no title, no card)
summary = "..."
logo = "wactorz-icon.svg"  # a file in landing/assets/
start = [{ label = "Guide", href = "/wactorz/guide/" }]                      # "Start here" links
get = [{ label = "pip install wactorz", href = "https://pypi.org/project/wactorz/", code = true }]  # "Get it"

The assembler checks the whole file before it fetches anything. It refuses two sites on one mount, a mount that is not /name/, unknown keys, a card without a title and a summary, and a card link that is neither https:// nor under the site's own mount. A site may be mounted inside another (/canvas/0.7/ inside /canvas/) as long as the outer one has no folder of that name.

At the top of the file, landing is "page" (the landing page in landing/ at the root) or a mount to redirect the root to. The domain is not in this file: a site deployed by a workflow takes its custom domain from the repository's Pages settings alone (GitHub ignores a CNAME file there).

With the page comes 404.html, which GitHub Pages serves for any missing path. It is served at any depth, so its links are written out from the site's root: deploy.yml takes that root from GitHub's Pages settings (/docs/ at waldiez.github.io/docs/, / once a custom domain serves the site) and passes it as --base-path.

Adding a project

  1. In the project, build its docs and push them to a branch (for example gh-pages, as an orphan branch). Then notify this repository:

    - name: Notify waldiez/docs
      env:
        GH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }}
      run: |
        if [ -z "$GH_TOKEN" ]; then echo "No DOCS_DISPATCH_TOKEN: not notified (the daily run will pick it up)"; exit 0; fi
        gh api repos/waldiez/docs/dispatches -f event_type=docs-updated
  2. Here, add its [[site]] to sites.toml, and its logo to landing/assets/ if it gets a card.

The built docs must use relative links (MkDocs and most generators do): the same files are served at docs.waldiez.io/<mount> and, for testing, under waldiez.github.io/docs/<mount>.

Working on it

Python 3.12 or newer; the assembler and its tests need only the standard library.

python -m unittest discover -s tests                     # tests (no network)
python scripts/assemble.py --out site                    # the whole site, as deploy.yml builds it
python scripts/assemble.py --landing-only --out site     # the landing page alone, nothing fetched
python -m http.server --directory site                   # look at it

The checks' tools are pinned with hashes in requirements-check.txt (pip install --require-hashes --no-deps -r requirements-check.txt). scripts/check_landing.py runs axe on a built landing page.

If a deploy goes wrong

Every deploy logs the commit it took from each site, and nothing is deployed when a fetch or a check fails, so the site stays as it was. To go back, revert the commit that changed sites.toml or landing/ and run Deploy by hand. The project's docs themselves are reverted in the project, on its docs branch.

GitHub turns off scheduled workflows in a public repository after 60 days without activity. Turn it back on from the Actions tab, or run Deploy by hand.

About

Documentation for waldiez.

Resources

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Used by

Contributors

Languages