You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: recipes/ci-cd/github-actions/workflows/mkdocs/generic.md
+44-10Lines changed: 44 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,21 +4,55 @@ description: Build and deploy MkDocs to GH Pages using generic actions
4
4
# Generic
5
5
6
6
7
-
## Sample
8
7
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
10
9
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.
17
11
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.
19
13
20
14
```sh
21
15
$ mkdocs gh-deploy --strict
22
16
```
23
17
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