Publishing a Repository's Docs to Learn
Learn is built from the central learn repository and from a
docs/learn/ tree in each component's repository. Follow these steps when
a repository first contributes pages, so that its documentation is
published and stays current.
Before you start #
- Lay out the repository's
docs/learn/tree as Trail merged trees require: the same shelves, products, and containers as Learn, with identical metadata. - Push the repository to GitHub.
Add the repository to the site #
-
In
learn/trail.toml, add a[[merge]]table after the existing ones:[[]] = "https://github.com/peios/authd" = "docs/learn" = "../authd/docs/learn"repoanddirare where Learn's deploy fetches the tree.pathis the repository's checkout besidelearn/in a workspace. Trail uses it when it exists, sotrail serve learnshows local edits. -
From the workspace root, build the combined site strictly:
Fix any duplicate pages, mismatched containers, or broken links it reports.
-
Commit the change to
learnand push it.
Redeploy when its documentation changes #
-
In the component's repository, add this file as
.github/workflows/update-learn.yml:name: Update Learn # Asks Learn to redeploy when this repository's documentation changes. The # same file goes in every repository that contributes to Learn. on: push: paths: permissions: jobs: dispatch: if: github.ref_name == github.event.repository.default_branch runs-on: ubuntu-latest steps: - run: gh api repos/peios/learn/dispatches -f event_type=docs-changed env: GH_TOKEN: ${{ secrets.LEARN_DISPATCH_TOKEN }}The file is the same in every repository. It runs only for pushes to the default branch that change
docs/. -
For a repository outside the
peiosorganization, add aLEARN_DISPATCH_TOKENrepository secret. Thepeiosorganization provides the secret to its own repositories. -
For a private repository, give Learn's
LEARN_READ_TOKENread access to its contents. Learn's deploy fetches the tree with that token.
Check the result #
Push a documentation change to the default branch. The repository's
Update Learn run succeeds, and a Deploy to GitHub Pages run starts
in peios/learn. When it finishes, the change is on learn.peios.org.