Skip to content

Commit a2065a1

Browse files
Update generic.md
1 parent 4217d8e commit a2065a1

File tree

1 file changed

+44
-10
lines changed
  • recipes/ci-cd/github-actions/workflows/mkdocs

1 file changed

+44
-10
lines changed

β€Žrecipes/ci-cd/github-actions/workflows/mkdocs/generic.mdβ€Ž

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,55 @@ description: Build and deploy MkDocs to GH Pages using generic actions
44
# Generic
55

66

7-
## Sample
87

9-
- [docs.yml](https://github.com/MichaelCurrin/mkdocs-quickstart/blob/master/.github/workflows/docs.yml) in my `mkdocs-quickstart` project.
8+
## The MkDocs GH deploy command
109

11-
That installs Python and dependencies, as with any Python project.
12-
13-
Then it runs a MkDocs CLI command to deploy, which you could can run locally or remotely. This avoids having to use special action around GH Pages or MkDocs - as MkDocs itself knows how to deploy to GitHub Pages.
14-
15-
16-
### Details on the deploy command
10+
That works locally and on GH Pages.
1711

18-
You can add this command to deploy a build and deploy in one step. Optionally use `--force` flag for force push.
12+
You can add this command to deploy a build and deploy it - all in one step. Optionally, use `--force` flag for force push.
1913

2014
```sh
2115
$ mkdocs gh-deploy --strict
2216
```
2317

24-
That works locally and on GH Pages.
18+
This will be used in samples below.
19+
20+
21+
## Samples
22+
23+
Flow:
24+
25+
1. The workflows installs Python and dependencies, as with any Python project.
26+
1. Then it runs a MkDocs CLI command to deploy, which you could run locally or remotely. This avoids having to use special action around GH Pages or MkDocs - as MkDocs itself knows how to deploy to GitHub Pages.
27+
28+
### Basic
29+
30+
- `docs.yml`
31+
```yaml
32+
jobs:
33+
build-deploy:
34+
name: Build and deploy docs
35+
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout πŸ›ŽοΈ
40+
uses: actions/checkout@v2
41+
42+
- name: Set up Python 3 βš™οΈ 🐍
43+
uses: actions/setup-python@v2
44+
45+
- name: Install dependencies πŸ”§
46+
working-directory: docs
47+
run: pip install -r requirements.txt
48+
49+
- name: Build and deploy to GitHub Pages πŸ—οΈ πŸš€
50+
working-directory: docs
51+
run: mkdocs gh-deploy --strict
52+
```
53+
54+
### Cache and Makefile
55+
56+
See this for a live example using `Makefile` and dependency caching.
57+
58+
- [docs.yml](https://github.com/MichaelCurrin/mkdocs-quickstart/blob/master/.github/workflows/docs.yml) in my `mkdocs-quickstart` project

0 commit comments

Comments
Β (0)