4
4
push :
5
5
branches :
6
6
- doc
7
+ - main
8
+ tags :
9
+ - ' v*'
7
10
paths :
8
11
- ' doc/**'
9
12
- ' mkdocs.yml'
16
19
- ' .github/workflows/docs.yml'
17
20
18
21
permissions :
19
- contents : read
20
- pages : write
21
- id-token : write
22
+ contents : write
22
23
23
24
concurrency :
24
- group : " pages "
25
+ group : " docs-${{ github.ref }} "
25
26
cancel-in-progress : false
26
27
27
28
jobs :
28
- build :
29
+ docs :
29
30
runs-on : ubuntu-latest
30
31
steps :
31
32
- name : Checkout
32
33
uses : actions/checkout@v4
33
34
with :
34
- fetch-depth : 0 # Needed for git-revision-date-localized plugin
35
+ fetch-depth : 0
35
36
36
37
- name : Setup Python
37
38
uses : actions/setup-python@v4
@@ -44,23 +45,25 @@ jobs:
44
45
pipx inject mkdocs mkdocs-material
45
46
pipx inject mkdocs pymdown-extensions
46
47
pipx inject mkdocs mkdocs-callouts
48
+ pipx inject mkdocs mike
49
+ pipx list --verbose
50
+ # Workaround, if pipx inject fails to install symlink
51
+ ln -s "$HOME/.local/share/pipx/venvs/mkdocs/bin/mike" "$HOME/.local/bin/mike" || true
47
52
48
- - name : Build documentation
49
- run : mkdocs build
53
+ - name : Configure Git
54
+ run : |
55
+ git config --global user.name "github-actions[bot]"
56
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
50
57
51
- - name : Upload Pages artifact
52
- uses : actions/upload-pages-artifact@v3
53
- with :
54
- path : site/
58
+ - name : Deploy dev version
59
+ if : github.event_name == 'push' && (github.ref == 'refs/heads/doc' || github.ref == 'refs/heads/main')
60
+ run : |
61
+ mike deploy --push --update-aliases dev latest
62
+ mike set-default --push latest
55
63
56
- deploy :
57
- if : github.ref == 'refs/heads/doc' && github.event_name == 'push'
58
- needs : build
59
- runs-on : ubuntu-latest
60
- environment :
61
- name : github-pages
62
- url : ${{ steps.deployment.outputs.page_url }}
63
- steps :
64
- - name : Deploy to GitHub Pages
65
- id : deployment
66
- uses : actions/deploy-pages@v4
64
+ - name : Deploy tagged version
65
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
66
+ run : |
67
+ VERSION=${GITHUB_REF#refs/tags/v}
68
+ mike deploy --push --update-aliases $VERSION latest
69
+ mike set-default --push latest
0 commit comments