@@ -9,7 +9,25 @@ This repository is host to:
99* ` elastic/docs-builder@main ` Github Action to build and validate a repositories documentation
1010
1111
12- ### Docs Builder
12+ ## Command line interface
13+
14+ ```
15+ $ docs-builder --help
16+ Usage: [command] [options...] [-h|--help] [--version]
17+
18+ Converts a source markdown folder or file to an output folder
19+
20+ Options:
21+ -p|--path <string?> Defaults to the`{pwd}/docs` folder (Default: null)
22+ -o|--output <string?> Defaults to `.artifacts/html` (Default: null)
23+ --path-prefix <string?> Specifies the path prefix for urls (Default: null)
24+ --force <bool?> Force a full rebuild of the destination folder (Default: null)
25+
26+ Commands:
27+ generate Converts a source markdown folder or file to an output folder
28+ serve Continuously serve a documentation folder at http://localhost:5000.
29+ File systems changes will be reflected without having to restart the server.
30+ ```
1331
1432In the near term native code will be published by CI for the following platforms
1533
@@ -51,7 +69,67 @@ docker run -v "./.git:/app/.git" -v "./docs:/app/docs" -v "./.artifacts:/app/.ar
5169Each page is compiled on demand as you browse http://localhost:8080 and is never cached so changes to files and
5270navigation will always be reflected upon refresh.
5371
54- # Run without docker
72+ Note the docker image is ` linux-x86 ` and will be somewhat slower to invoke on OSX due to virtualization.
73+
74+
75+ ## Github Action
76+
77+ The ` docs-builder ` tool is available as github action.
78+
79+ Since it runs from a precompiled distroless image ` ~25mb ` it's able to execute snappy. (no need to wait for building the tool itself)
80+
81+
82+ ``` yaml
83+ jobs :
84+ docs :
85+ runs-on : ubuntu-latest
86+ steps :
87+ - uses : actions/checkout@v4
88+ - name : Build documentation
89+ uses : elastic/docs-builder@main
90+ ` ` `
91+
92+
93+
94+ ### GitHub Pages
95+
96+ To setup the tool to publish to GitHub pages use the following configuration.
97+ **NOTE**: In the near feature we'll make this a dedicated single step Github ction
98+
99+ ` ` ` yaml
100+ steps :
101+ - id : repo-basename
102+ run : ' echo "value=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT'
103+ - uses : actions/checkout@v4
104+ - name : Setup Pages
105+ id : pages
106+ 107+ - name : Build documentation
108+ uses : elastic/docs-builder@main
109+ with :
110+ prefix : ' ${{ steps.repo-basename.outputs.value }}'
111+ - name : Upload artifact
112+ 113+ with :
114+ path : .artifacts/docs/html
115+
116+ - name : Deploy artifact
117+ id : deployment
118+ 119+ ` ` `
120+
121+ Note ` prefix:` is required to inject the appropiate `--path-prefix` argument to `docs-builder`
122+
123+ Also make sure your repository settings are set up to deploy from github actions see :
124+
125+ https://github.com/elastic/{your-repository}/settings/pages
126+
127+ ---
128+ 
129+
130+ ---
131+
132+ # # Run without docker
55133
56134If you have dotnet 8 installed you can use its CLI to publish a self-contained `docs-builder` native code
57135binary. (On my M2 Pro mac the binary is currently 13mb)
0 commit comments