Skip to content

Commit a5d3cfb

Browse files
committed
Add docs version support
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
1 parent d7590f0 commit a5d3cfb

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/docs.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
paths:
88
- 'docs/**'
99
- 'mkdocs.yml'
10+
release:
11+
types:
12+
- published
1013
workflow_dispatch:
1114

1215
permissions:
@@ -17,11 +20,31 @@ jobs:
1720
runs-on: ubuntu-latest
1821
steps:
1922
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
2025

2126
- uses: actions/setup-python@v5
2227
with:
2328
python-version: 3.x
2429

25-
- run: pip install mkdocs-material
30+
- run: pip install mkdocs-material mike
31+
32+
- name: Configure git user
33+
run: |
34+
git config user.name "github-actions[bot]"
35+
git config user.email "github-actions[bot]@users.noreply.github.com"
36+
37+
- name: Deploy dev docs (push to main)
38+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
39+
run: |
40+
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version --quiet -DforceStdout)
41+
mike deploy --push --update-aliases "${PROJECT_VERSION}" dev
42+
# mike deploy --push --update-aliases dev
43+
# mike set-default dev --push
2644
27-
- run: mkdocs gh-deploy --force
45+
- name: Deploy versioned docs (release)
46+
if: github.event_name == 'release'
47+
run: |
48+
VERSION=${GITHUB_REF_NAME}
49+
mike deploy --push --update-aliases "${VERSION}" latest
50+
mike set-default latest --push

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ plugins:
8686
- blog
8787

8888
extra:
89+
version:
90+
provider: mike
91+
alias: true
8992
social:
9093
- icon: fontawesome/brands/github
9194
link: https://github.com/modelcontextprotocol/java-sdk

0 commit comments

Comments
 (0)