Skip to content

Commit 4716087

Browse files
committed
ci: Refactor documentation deployment workflow for GitHub Pages
This commit updates the documentation deployment workflow (`docs.yml`) to align with current best practices for deploying to GitHub Pages. - **Permissions:** Added `pages: write` and `id-token: write` permissions, which are required for modern GitHub Pages deployments. - **Git Configuration:** Added a step to configure the Git user name and email for the `github-actions[bot]`. - **Deployment Steps:** The deployment process has been split into two distinct steps: 1. `mkdocs build --strict`: Builds the MkDocs site. The `--strict` flag ensures the build fails on any warnings. 2. `mkdocs gh-deploy --force --clean --verbose`: Deploys the built site to GitHub Pages, cleaning the target branch before deployment and providing verbose output.
1 parent 66e35b3 commit 4716087

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/docs.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010

1111
permissions:
1212
contents: write
13+
pages: write
14+
id-token: write
1315

1416
jobs:
1517
deploy:
@@ -20,6 +22,11 @@ jobs:
2022
with:
2123
fetch-depth: 0
2224

25+
- name: Configure Git
26+
run: |
27+
git config user.name "github-actions[bot]"
28+
git config user.email "github-actions[bot]@users.noreply.github.com"
29+
2330
- name: Set up Python
2431
uses: actions/setup-python@v5
2532
with:
@@ -37,6 +44,10 @@ jobs:
3744
run: |
3845
pip install -r requirements.txt
3946
40-
- name: Build and deploy MkDocs to GitHub Pages
47+
- name: Build MkDocs site
48+
run: |
49+
mkdocs build --strict
50+
51+
- name: Deploy to GitHub Pages
4152
run: |
42-
mkdocs gh-deploy --force
53+
mkdocs gh-deploy --force --clean --verbose

0 commit comments

Comments
 (0)