Skip to content

Commit 0532287

Browse files
committed
Use an "umbrella task" for generated documentation
There may be project-specific documentation generation. The most prominent is the command line reference generation for projects using Cobra. Another is Arduino CLI's gRPC interface documentation. These project-specific generations should have dedicated tasks with appropriate names. A single umbrella task is used to run all the documentation generation tasks the project has. This umbrella task uses a standardized name: `docs:generate`. In this manner, the templates can be configured to be general purpose and work for all projects without requiring significant changes to account for the specifics of their documentation generation requirements. In the event the project does not generate any documentation content, the task can simply be left empty.
1 parent bda5024 commit 0532287

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
lines changed

workflow-templates/assets/check-markdown-task/Taskfile.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
version: "3"
33

44
tasks:
5+
docs:generate:
6+
desc: Create all generated documentation content
7+
# This is an "umbrella" task used to call any documentation generation processes the project has.
8+
# It can be left empty if there are none.
9+
510
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
611
markdown:lint:
712
desc: Check for problems in Markdown files
@@ -17,6 +22,8 @@ tasks:
1722
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml
1823
markdown:check-links:
1924
desc: Check for broken links
25+
deps:
26+
- task: docs:generate
2027
cmds:
2128
- |
2229
if [[ "{{.OS}}" == "Windows_NT" ]]; then

workflow-templates/assets/check-mkdocs-task/Taskfile.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
version: "3"
33

44
tasks:
5+
docs:generate:
6+
desc: Create all generated documentation content
7+
# This is an "umbrella" task used to call any documentation generation processes the project has.
8+
# It can be left empty if there are none.
9+
510
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
611
website:check:
712
desc: Check whether the MkDocs-based website will build
813
deps:
14+
- task: docs:generate
915
- task: poetry:install-deps
1016
cmds:
1117
- poetry run mkdocs build --strict
@@ -14,6 +20,7 @@ tasks:
1420
website:serve:
1521
desc: Run website locally
1622
deps:
23+
- task: docs:generate
1724
- task: poetry:install-deps
1825
cmds:
1926
- poetry run mkdocs serve

workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ vars:
55

66
tasks:
77
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
8-
docs:gen:
9-
desc: Generate command reference
8+
docs:generate:
9+
desc: Create all generated documentation content
10+
deps:
11+
- task: go:cli-docs
12+
# Make the formatting consistent with the non-generated Markdown
13+
- task: general:format-prettier
14+
15+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/deploy-cobra-mkdocs-versioned-poetry/Taskfile.yml
16+
go:cli-docs:
17+
desc: Generate command line interface reference documentation
1018
dir: ./docsgen
1119
cmds:
1220
# Command examples use os.Args[0] so the docs generation binary must have the same filename as the project
1321
- go build -o {{.PROJECT_NAME}}{{exeExt}}
1422
# The binary is invoked like this instead of `./{{.PROJECT_NAME}}` to remove the `./` chars from the examples
1523
- PATH=. {{.PROJECT_NAME}} ../docs/commands
16-
- task: docs:format

workflow-templates/check-markdown-task.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ The code style defined in `.markdownlint.yml` is the official standardized style
2828

2929
### Configuration
3030

31+
#### Taskfile
32+
33+
Add any documentation generation processes to the `docs:generate` umbrella task.
34+
3135
#### markdownlint
3236

3337
In the event the repository contains externally maintained Markdown files, `markdownlint` can be configured to ignore them via a `.markdownlintignore` file:

workflow-templates/check-mkdocs-task.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ See [the "Deploy Website" (MkDocs, Poetry) workflow documentation](deploy-mkdocs
2424

2525
### Configuration
2626

27+
#### Taskfile
28+
29+
Add any documentation generation processes to the `docs:generate` umbrella task.
30+
31+
#### MkDocs
32+
2733
See [the "Deploy Website" (MkDocs, Poetry) workflow documentation](deploy-mkdocs-poetry.md#configuration)
2834

2935
### Readme badge

0 commit comments

Comments
 (0)