Skip to content

Commit f8a4172

Browse files
ktro2828Copilot
andauthored
ci: update deployment process for the documentation (#205)
* ci: update deployment process of documentation Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * fix: update mkdocs config for better version selector Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * Update .github/workflows/deploy-document.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore: fix pre-commit Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9427c16 commit f8a4172

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/deploy-document.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ on:
88
workflow_dispatch:
99
inputs:
1010
version:
11-
description: "Version to deploy (e.g., v1.0.0, latest, dev)"
11+
description: "Version to deploy (e.g., v1.0.0, latest, develop)"
1212
required: true
13-
default: "latest"
13+
default: "develop"
1414
alias:
1515
description: "Version alias (e.g., latest, stable)"
1616
required: false
1717
default: ""
1818

19+
permissions:
20+
contents: write # Required for mike to push to gh-pages branch
21+
1922
jobs:
2023
deploy-document:
2124
runs-on: ubuntu-latest
@@ -45,27 +48,36 @@ jobs:
4548
VERSION="${{ github.event.inputs.version }}"
4649
ALIAS="${{ github.event.inputs.alias }}"
4750
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
51+
# For version tags (e.g., v1.0.0), use the tag name and set latest alias
4852
VERSION="${{ github.ref_name }}"
4953
ALIAS="latest"
5054
else
55+
# For main branch pushes (non-tag), deploy as develop
5156
VERSION="develop"
5257
ALIAS=""
5358
fi
5459
echo "version=$VERSION" >> $GITHUB_OUTPUT
5560
echo "alias=$ALIAS" >> $GITHUB_OUTPUT
56-
echo "Deploying version: $VERSION"
5761
5862
- name: Deploy documentation
5963
run: |
6064
VERSION="${{ steps.version.outputs.version }}"
6165
ALIAS="${{ steps.version.outputs.alias }}"
6266
6367
if [[ -n "$ALIAS" ]]; then
68+
echo "Deploying documentation for version: $VERSION with alias: $ALIAS"
6469
uv run mike deploy --push --update-aliases $VERSION $ALIAS
6570
uv run mike set-default --push $ALIAS
6671
else
72+
echo "Deploying documentation for version: $VERSION (no alias set)"
6773
uv run mike deploy --push $VERSION
6874
fi
75+
env:
76+
# Ensure GitHub Pages deployment works correctly
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6978

70-
- name: List versions
71-
run: uv run mike list
79+
- name: List deployed versions
80+
run: |
81+
echo "Currently deployed versions:"
82+
uv run mike list
83+
echo "Documentation deployment completed successfully!"

mkdocs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ plugins:
5050
- search
5151
- mike:
5252
version_selector: true
53+
canonical_version: latest
5354
- mkdocstrings:
5455
handlers:
5556
python:

0 commit comments

Comments
 (0)