Skip to content

Commit 1aa48ac

Browse files
committed
Improve docs versioning UI
1 parent f850354 commit 1aa48ac

2 files changed

Lines changed: 30 additions & 33 deletions

File tree

.github/workflows/deploy-python-docs.yml

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
working-directory: bindings/python
5959
run: |
6060
pip install --upgrade pip
61-
pip install mkdocs-material mkdocs-git-revision-date-localized-plugin
61+
pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mike
6262
6363
- name: Validate docs token
6464
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
@@ -93,45 +93,42 @@ jobs:
9393
token: ${{ secrets.HUMEMAI_DOCS_TOKEN }}
9494
path: humemai-docs
9595

96-
- name: Build documentation
97-
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
98-
working-directory: bindings/python
96+
- name: Deploy with mike (set as latest)
97+
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'push') && steps.version.outputs.set_latest == 'true'
98+
working-directory: humemai-docs
9999
env:
100100
MIKE_VERSION: ${{ steps.version.outputs.version }}
101101
run: |
102-
mkdocs build -f mkdocs.yml -d /tmp/site
102+
mike deploy --update-aliases \
103+
--deploy-prefix arcadedb \
104+
--branch ${{ env.DOCS_BRANCH }} \
105+
--config-file ../bindings/python/mkdocs.yml \
106+
${{ steps.version.outputs.version }} latest \
107+
--title "${{ steps.version.outputs.version }}"
108+
mike set-default \
109+
--deploy-prefix arcadedb \
110+
--branch ${{ env.DOCS_BRANCH }} \
111+
latest
103112
104-
- name: Publish docs to humemai-docs
113+
- name: Deploy with mike (not latest)
114+
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'push') && steps.version.outputs.set_latest != 'true'
115+
working-directory: humemai-docs
116+
env:
117+
MIKE_VERSION: ${{ steps.version.outputs.version }}
118+
run: |
119+
mike deploy \
120+
--deploy-prefix arcadedb \
121+
--branch ${{ env.DOCS_BRANCH }} \
122+
--config-file ../bindings/python/mkdocs.yml \
123+
${{ steps.version.outputs.version }} \
124+
--title "${{ steps.version.outputs.version }}"
125+
126+
- name: Commit and push docs
105127
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
128+
working-directory: humemai-docs
106129
env:
107130
VERSION: ${{ steps.version.outputs.version }}
108-
SET_LATEST: ${{ steps.version.outputs.set_latest }}
109131
run: |
110-
set -e
111-
DEST="humemai-docs/arcadedb/${VERSION}"
112-
mkdir -p "$DEST"
113-
rsync -a --delete /tmp/site/ "$DEST/"
114-
115-
if [ "$SET_LATEST" = "true" ]; then
116-
mkdir -p humemai-docs/arcadedb/latest
117-
rsync -a --delete /tmp/site/ humemai-docs/arcadedb/latest/
118-
cat > humemai-docs/arcadedb/index.html <<'EOF'
119-
<!doctype html>
120-
<html lang="en">
121-
<head>
122-
<meta charset="utf-8" />
123-
<meta http-equiv="refresh" content="0; url=/arcadedb/latest/" />
124-
<meta name="robots" content="noindex" />
125-
<title>Redirecting…</title>
126-
</head>
127-
<body>
128-
<p>Redirecting to <a href="/arcadedb/latest/">/arcadedb/latest/</a></p>
129-
</body>
130-
</html>
131-
EOF
132-
fi
133-
134-
cd humemai-docs
135132
git config user.name "github-actions[bot]"
136133
git config user.email "github-actions[bot]@users.noreply.github.com"
137134
git add arcadedb

bindings/python/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extra:
118118
- icon: fontawesome/brands/github
119119
link: https://github.com/humemai/arcadedb-embedded-python
120120
- icon: fontawesome/brands/python
121-
link: https://pypi.org/project/arcadedb-embedded-python/
121+
link: https://pypi.org/project/arcadedb-embedded/
122122
version: !ENV [MIKE_VERSION, latest]
123123

124124
extra_css:

0 commit comments

Comments
 (0)