Skip to content

Commit 2484626

Browse files
authored
Merge pull request #25 from per1234/mkdocs
Add template workflows for managing a MkDocs-based website
2 parents e8fdccc + 4382387 commit 2484626

File tree

9 files changed

+364
-0
lines changed

9 files changed

+364
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# See: https://taskfile.dev/#/usage
2+
version: "3"
3+
4+
tasks:
5+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml
6+
website:check:
7+
desc: Check whether the MkDocs-based website will build
8+
deps:
9+
- task: poetry:install-deps
10+
cmds:
11+
- poetry run mkdocs build --strict
846 Bytes
Loading
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/mkdocs/mkdocs.yml
2+
# See: https://www.mkdocs.org/user-guide/configuration/
3+
4+
# TODO: Fill in all blank fields below.
5+
site_name:
6+
site_description:
7+
site_url:
8+
9+
repo_name:
10+
repo_url:
11+
edit_uri: blob/main/docs/
12+
13+
copyright: Copyright 2021 ARDUINO SA (http://www.arduino.cc/)
14+
15+
theme:
16+
name: material
17+
logo: img/icon_mac_light.png
18+
palette:
19+
primary: teal
20+
accent: orange
21+
22+
markdown_extensions:
23+
- markdown.extensions.codehilite:
24+
guess_lang: false
25+
- markdown.extensions.toc:
26+
permalink: true
27+
- mdx_truly_sane_lists:
28+
nested_indent: 2
29+
truly_sane: true
30+
- pymdownx.betterem:
31+
smart_enable: all
32+
- pymdownx.details
33+
- pymdownx.emoji:
34+
emoji_generator: !!python/name:pymdownx.emoji.to_svg
35+
emoji_index: !!python/name:pymdownx.emoji.twemoji
36+
- pymdownx.magiclink:
37+
repo: contributor-guide
38+
repo_url_shorthand: true
39+
user: arduino
40+
- pymdownx.superfences
41+
- pymdownx.tasklist:
42+
custom_checkbox: true
43+
- pymdownx.tilde
44+
45+
nav:
46+
- Home: index.md
47+
# TODO: Define navigation structure for all other source files.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# "Check Website" workflow (MkDocs, Task)
2+
3+
Workflow file: [check-mkdocs-task.yml](check-mkdocs-task.yml)
4+
5+
Check for problems with a [MkDocs](https://www.mkdocs.org/)-based static website.
6+
7+
This is the version of the workflow for projects using the [Task](https://taskfile.dev/#/) task runner tool.
8+
9+
## Installation
10+
11+
See [the "Deploy Website" (MkDocs, Poetry) workflow documentation](deploy-mkdocs-poetry.md#installation)
12+
13+
## Assets
14+
15+
- [`Taskfile.yml`](assets/check-yaml-task/Taskfile.yml] - Build task.
16+
- Install to: repository root (or add the `website:build` task into the existing `Taskfile.yml`)
17+
- [`Taskfile.yml`](assets/shared/Taskfile.yml] - Installation task.
18+
- Add the `poetry:install-deps` task into the existing `Taskfile.yml`
19+
- Website assets - See [the "Deploy Website" (MkDocs, Poetry) workflow documentation](deploy-mkdocs-poetry.md#assets).
20+
21+
## Readme badge
22+
23+
Markdown badge:
24+
25+
```markdown
26+
[![Check Website status](https://github.com/REPO_OWNER/REPO_NAME/actions/workflows/check-mkdocs-task.yml/badge.svg)](https://github.com/REPO_OWNER/REPO_NAME/actions/workflows/check-mkdocs-task.yml)
27+
```
28+
29+
Replace the `REPO_OWNER` and `REPO_NAME` placeholders in the URLs with the final repository owner and name ([example](https://raw.githubusercontent.com/arduino-libraries/ArduinoIoTCloud/master/README.md)).
30+
31+
---
32+
33+
Asciidoc badge:
34+
35+
```adoc
36+
image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-mkdocs-task.yml/badge.svg["Check Website status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-mkdocs-task.yml"]
37+
```
38+
39+
Define the `{repository-owner}` and `{repository-name}` attributes and use them throughout the readme ([example](https://raw.githubusercontent.com/arduino-libraries/WiFiNINA/master/README.adoc)).
40+
41+
## Commit message
42+
43+
```
44+
Add CI workflow to check for problems with MkDocs-based website
45+
46+
On every push or pull request that affects the source and configuration for the repository's MkDocs-based static
47+
website, build the site and fail if any problems were encountered.
48+
```
49+
50+
## PR message
51+
52+
```markdown
53+
On every push or pull request that affects the source and configuration for the repository's [MkDocs](https://www.mkdocs.org/)-based static website, build the site and fail if any problems were encountered.
54+
```
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-mkdocs-task.md
2+
name: Check Website
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/check-mkdocs-task.ya?ml"
9+
- "Taskfile.ya?ml"
10+
- "mkdocs.ya?ml"
11+
- "poetry.lock"
12+
- "pyproject.toml"
13+
- "docs/**"
14+
pull_request:
15+
paths:
16+
- ".github/workflows/check-mkdocs-task.ya?ml"
17+
- "Taskfile.ya?ml"
18+
- "mkdocs.ya?ml"
19+
- "poetry.lock"
20+
- "pyproject.toml"
21+
- "docs/**"
22+
workflow_dispatch:
23+
repository_dispatch:
24+
25+
jobs:
26+
check:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v2
32+
33+
- name: Install Python
34+
uses: actions/setup-python@v2
35+
with:
36+
python-version: "3.9"
37+
38+
- name: Install Poetry
39+
run: pip install poetry
40+
41+
- name: Install Task
42+
uses: arduino/setup-task@v1
43+
with:
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
version: 3.x
46+
47+
- name: Build website
48+
run: task website:check
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-mkdocs-task.md
2+
name: Check Website
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/check-mkdocs-task.ya?ml"
9+
- "Taskfile.ya?ml"
10+
- "mkdocs.ya?ml"
11+
- "poetry.lock"
12+
- "pyproject.toml"
13+
- "docs/**"
14+
pull_request:
15+
paths:
16+
- ".github/workflows/check-mkdocs-task.ya?ml"
17+
- "Taskfile.ya?ml"
18+
- "mkdocs.ya?ml"
19+
- "poetry.lock"
20+
- "pyproject.toml"
21+
- "docs/**"
22+
workflow_dispatch:
23+
repository_dispatch:
24+
25+
jobs:
26+
check:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v2
32+
33+
- name: Install Python
34+
uses: actions/setup-python@v2
35+
with:
36+
python-version: "3.9"
37+
38+
- name: Install Poetry
39+
run: pip install poetry
40+
41+
- name: Install Task
42+
uses: arduino/setup-task@v1
43+
with:
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
version: 3.x
46+
47+
- name: Build website
48+
run: task website:check
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Source: https://github.com/arduino/.github/blob/master/workflow-templates/deploy-mkdocs-poetry.md
2+
name: Deploy Website
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
branches:
8+
# TODO: Replace "main" below with default branch name if different.
9+
- main
10+
paths:
11+
- ".github/workflows/deploy-mkdocs-poetry.ya?ml"
12+
- "mkdocs.ya?ml"
13+
- "poetry.lock"
14+
- "pyproject.toml"
15+
- "docs/**"
16+
workflow_dispatch:
17+
repository_dispatch:
18+
19+
jobs:
20+
publish:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Install Python
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: "3.9"
31+
32+
- name: Install Poetry
33+
run: pip install poetry
34+
35+
- name: Install Dependencies
36+
run: poetry install --no-root
37+
38+
- name: Deploy website
39+
run: poetry run mkdocs gh-deploy
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# "Deploy Website" workflow (MkDocs, Poetry)
2+
3+
Workflow file: [deploy-mkdocs-poetry.yml](deploy-mkdocs-poetry.yml)
4+
5+
Deploy a [MkDocs](https://www.mkdocs.org/)-based static website to [GitHub Pages](https://pages.github.com/).
6+
7+
This is the version of the workflow for projects using the [Poetry](https://python-poetry.org/) dependency management tool.
8+
9+
## Installation
10+
11+
The website build dependencies are managed by [Poetry](https://python-poetry.org/).
12+
13+
Install Poetry by following these instructions:<br />
14+
https://python-poetry.org/docs/#installation
15+
16+
If your project does not already use Poetry, you can initialize the [`pyproject.toml`](https://python-poetry.org/docs/pyproject/) file using these commands:
17+
18+
```
19+
poetry init --python="^3.9" --dev-dependency="mkdocs@^1.2.1" --dev-dependency="mkdocs-material@^7.1.8" --dev-dependency="mdx_truly_sane_lists@^1.2"
20+
poetry install
21+
```
22+
23+
If already using Poetry, add the tool using this command:
24+
25+
```
26+
poetry add --dev "mkdocs@^1.2.1" "mkdocs-material@^7.1.8" "mdx_truly_sane_lists@^1.2"
27+
```
28+
29+
Make sure to commit the resulting `pyproject.toml` and `poetry.lock` files.
30+
31+
## Assets
32+
33+
- [mkdocs.yml](assets/mkdocs/mkdocs.yml) - base MkDocs configuration file.
34+
- Install to: repository root
35+
- [icon_mac_light.png](assets/mkdocs/icon_mac_light.png) - Arduino logo for the website. **NOTE**: only for use in official Arduino projects. Community projects should use [the Community Logo](https://www.arduino.cc/en/Trademark/CommunityLogo).
36+
- Install to: `docs/img/`
37+
38+
## Readme badge
39+
40+
Markdown badge:
41+
42+
```markdown
43+
[![Deploy MkDocs Website status](https://github.com/REPO_OWNER/REPO_NAME/actions/workflows/deploy-mkdocs-poetry.yml/badge.svg)](https://github.com/REPO_OWNER/REPO_NAME/actions/workflows/deploy-mkdocs-poetry.yml)
44+
```
45+
46+
Replace the `REPO_OWNER` and `REPO_NAME` placeholders in the URLs with the final repository owner and name ([example](https://raw.githubusercontent.com/arduino-libraries/ArduinoIoTCloud/master/README.md)).
47+
48+
---
49+
50+
Asciidoc badge:
51+
52+
```adoc
53+
image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/deploy-mkdocs-poetry.yml/badge.svg["Deploy MkDocs Website status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/deploy-mkdocs-poetry.yml"]
54+
```
55+
56+
Define the `{repository-owner}` and `{repository-name}` attributes and use them throughout the readme ([example](https://raw.githubusercontent.com/arduino-libraries/WiFiNINA/master/README.adoc)).
57+
58+
## Commit message
59+
60+
```
61+
Add CI workflow to deploy a MkDocs-based website to GitHub Pages
62+
63+
On every push to the repository's default branch, deploy the repository's MkDocs-based static website to GitHub Pages.
64+
```
65+
66+
## PR message
67+
68+
```markdown
69+
On every push to the repository's default branch, deploy the repository's [MkDocs](https://www.mkdocs.org/)-based static website to [GitHub Pages](https://pages.github.com/).
70+
```
71+
72+
## Related
73+
74+
- ["Check MkDocs Website" workflow](check-mkdocs.md)
75+
- ["Check Markdown" workflow](check-markdown.md)
76+
- ["Check Prettier Formatting" workflow](check-prettier-formatting.md)
77+
- ["Spell Check" workflow](spell-check.md)
78+
- ["Check YAML" workflow](check-yaml.md)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Source: https://github.com/arduino/.github/blob/master/workflow-templates/deploy-mkdocs-poetry.md
2+
name: Deploy Website
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
branches:
8+
# TODO: Replace "main" below with default branch name if different.
9+
- main
10+
paths:
11+
- ".github/workflows/deploy-mkdocs-poetry.ya?ml"
12+
- "mkdocs.ya?ml"
13+
- "poetry.lock"
14+
- "pyproject.toml"
15+
- "docs/**"
16+
workflow_dispatch:
17+
repository_dispatch:
18+
19+
jobs:
20+
publish:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Install Python
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: "3.9"
31+
32+
- name: Install Poetry
33+
run: pip install poetry
34+
35+
- name: Install Dependencies
36+
run: poetry install --no-root
37+
38+
- name: Deploy website
39+
run: poetry run mkdocs gh-deploy

0 commit comments

Comments
 (0)