Skip to content

Commit a577b72

Browse files
committed
fix: switch to GitHub Pages Actions deployment
- Use official GitHub Pages Actions instead of branch deployment - This completely bypasses Jekyll processing - Provides proper artifact upload and deployment process - Requires changing repository settings to 'GitHub Actions' source
1 parent 7008528 commit a577b72

File tree

1 file changed

+36
-28
lines changed

1 file changed

+36
-28
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,58 @@
1-
name: build-mkdocs-gh-pages-branch
1+
name: Deploy MkDocs to GitHub Pages
22

33
on:
44
push:
55
branches:
66
- main
77

8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
89
permissions:
9-
contents: write
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
1019

1120
jobs:
12-
deploy:
21+
build:
1322
runs-on: ubuntu-latest
1423
steps:
1524
- name: Checkout repository
1625
uses: actions/checkout@v4
1726
with:
18-
fetch-depth: 0 # Fetch all history for all branches and tags
27+
fetch-depth: 0
1928

20-
- uses: actions/setup-python@v5
29+
- name: Setup Python
30+
uses: actions/setup-python@v5
2131
with:
2232
python-version: '3.x'
2333

2434
- name: Install dependencies
25-
run: |
35+
run: |
2636
pip install mkdocs-material mkdocs-git-revision-date-localized-plugin pymdown-extensions mkdocs-mermaid2-plugin
2737
28-
- name: Configure git
29-
run: |
30-
git config --global user.name "github-actions[bot]"
31-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
38+
- name: Build MkDocs site
39+
run: mkdocs build --clean
3240

33-
- name: Build and Deploy
34-
run: |
35-
# Build the site
36-
mkdocs build
37-
38-
# Add .nojekyll to disable Jekyll processing
39-
touch site/.nojekyll
40-
41-
# Deploy to gh-pages branch manually to ensure .nojekyll is included
42-
cd site
43-
git init
44-
git add -A
45-
git commit -m "Deploy MkDocs site"
46-
git branch -M gh-pages
47-
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
48-
git push -f origin gh-pages
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v4
43+
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: './site'
48+
49+
deploy:
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
runs-on: ubuntu-latest
54+
needs: build
55+
steps:
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)