Skip to content

Commit ef4e819

Browse files
lapp0rlouf
authored andcommitted
Version the Documentation
1 parent 0da7039 commit ef4e819

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

.github/workflows/publish_documentation.yml

+24-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
push:
66
branches:
77
- main
8+
release:
9+
types:
10+
- created
811

912
permissions:
1013
contents: write
@@ -14,6 +17,8 @@ jobs:
1417
runs-on: ubuntu-latest
1518
steps:
1619
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
1722
- uses: actions/setup-python@v4
1823
with:
1924
python-version: 3.x
@@ -25,7 +30,24 @@ jobs:
2530
restore-keys: |
2631
mkdocs-material-
2732
- run: pip install -r requirements-doc.txt
28-
- name: Build documentation
33+
- run: mkdocs build
34+
35+
- name: Set up Git
36+
run: |
37+
git config user.name ${{ github.actor }}
38+
git config user.email ${{ github.actor }}@users.noreply.github.com
39+
40+
- name: Publish Tag as latest
41+
env:
42+
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
43+
if: github.event_name == 'release'
44+
run: |
45+
mike deploy --push --update-aliases ${{ github.ref_name }} latest
46+
mike set-default --push latest
47+
48+
- name: Publish main as unstable
2949
env:
3050
GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
31-
run: mkdocs gh-deploy --force
51+
if: github.event_name == 'push'
52+
run: |
53+
mike deploy --push --update-aliases ${{ github.ref_name }} unstable

mkdocs.yml

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ extra:
4545
analytics:
4646
provider: google
4747
property: !ENV GOOGLE_ANALYTICS_KEY
48+
version:
49+
provider: mike
50+
default: latest
51+
alias: true
4852

4953
# Extensions
5054
markdown_extensions:

requirements-doc.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ mkdocs-section-index
66
mkdocstrings[python]
77
mkdocs-git-committers-plugin-2
88
mkdocs-git-revision-date-localized-plugin
9+
mike

0 commit comments

Comments
 (0)