Skip to content

Commit 5235cac

Browse files
committed
feat: add GitHub Actions workflow for deploying MkDocs to GitHub Pages
1 parent bbe7aee commit 5235cac

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Deploy MkDocs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0 # Fetch full history for git-revision-date-localized plugin
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: '3.x'
34+
35+
- name: Cache pip dependencies
36+
uses: actions/cache@v3
37+
with:
38+
path: ~/.cache/pip
39+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
40+
restore-keys: |
41+
${{ runner.os }}-pip-
42+
43+
- name: Install dependencies
44+
run: |
45+
pip install --upgrade pip
46+
pip install mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin
47+
48+
- name: Setup Pages
49+
uses: actions/configure-pages@v3
50+
51+
- name: Build with MkDocs
52+
run: mkdocs build --strict
53+
54+
- name: Upload artifact
55+
uses: actions/upload-pages-artifact@v2
56+
with:
57+
path: ./site
58+
59+
deploy:
60+
environment:
61+
name: github-pages
62+
url: ${{ steps.deployment.outputs.page_url }}
63+
runs-on: ubuntu-latest
64+
needs: build
65+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
66+
steps:
67+
- name: Deploy to GitHub Pages
68+
id: deployment
69+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)