Skip to content

Commit 34eef43

Browse files
committed
ci: add GitHub Pages deployment workflow
1 parent d56f066 commit 34eef43

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

‎.github/workflows/gh-pages.yml‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
30+
- name: Cache dependencies
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.cache/pip
34+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
35+
restore-keys: |
36+
${{ runner.os }}-pip-
37+
38+
- name: Install dependencies
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install mkdocs-material mkdocs-minify-plugin pymdown-extensions
42+
43+
- name: Build documentation
44+
run: mkdocs build --strict
45+
46+
- name: Deploy to GitHub Pages
47+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
48+
uses: peaceiris/actions-gh-pages@v3
49+
with:
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
51+
publish_dir: ./site
52+
cname: docs.comptext.dev
53+
user_name: 'github-actions[bot]'
54+
user_email: 'github-actions[bot]@users.noreply.github.com'
55+
commit_message: 'docs: deploy documentation [skip ci]'

0 commit comments

Comments
 (0)