-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (52 loc) · 1.84 KB
/
deploy-mkdocs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Deploy MkDocs to GitHub Pages
on:
push:
branches:
- main # Deploy when changes are pushed to the main branch
paths:
- 'docs/**' # Deploy when changes are made to the docs directory
- 'mkdocs.yml' # Deploy when changes are made to the MkDocs configuration file
- 'pyproject.toml' # Deploy when changes are made to the Poetry configuration file
- '.python-version' # Deploy when changes are made to the Python version file
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Python version from .python-version
id: python_version
run: echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV
- name: Set up Python
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install
- name: Build MkDocs site
run: poetry run mkdocs build
- name: Archive built site
uses: actions/upload-artifact@v4
with:
name: mkdocs-site
path: site
deploy:
needs: build # Ensure the 'build' job completes successfully before deploying
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download built site
uses: actions/download-artifact@v4
with:
name: mkdocs-site
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./site