Skip to content

Commit 1ae0b54

Browse files
Create generate_documentation.yml
Workflow to build and deploy the documentation using mkdocs-material theme
1 parent 716a8c4 commit 1ae0b54

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build & Deploy Documentation
2+
3+
on:
4+
# Runs on pushes targeting the default branch
5+
push:
6+
branches: ["main"]
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
12+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
13+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
19+
jobs:
20+
# Builds the documentation using the mkdocs-material theme and commits the files to the gh-pages branch
21+
build:
22+
23+
# Sets permissions of the GITHUB_TOKEN to allow commits to the gh-pages branch
24+
permissions:
25+
contents: write
26+
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Instal pgnquant for optimize plugin
36+
run: sudo apt-get install pngquant
37+
38+
- name: Set up Python runtime
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: 3.x
42+
43+
- name: Install Python dependencies
44+
run: pip install mkdocs-monorepo-plugin mkdocs-redirects mkdocs-git-authors-plugin mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 Pillow 'mkdocs-material[imaging]'
45+
46+
- name: Set up build cache
47+
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
48+
- uses: actions/cache@v4
49+
with:
50+
key: mkdocs-material-${{ env.cache_id }}
51+
path: .cache
52+
restore-keys: |
53+
mkdocs-material-
54+
55+
- name: Install Insiders build
56+
env:
57+
MKDOCS_TOKEN: ${{ secrets.MKDOCS_SECRET }}
58+
run: pip install git+https://${MKDOCS_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
59+
- run: mkdocs build --clean
60+
61+
62+
# Deploys the documentation files from the gh-pages branch to GitHub Pages
63+
deploy:
64+
# Add a dependency to the build job
65+
needs: build
66+
67+
# Grant GITHUB_TOKEN the permissions to allow deployment to GitHub Pages
68+
permissions:
69+
pages: write # to deploy to Pages
70+
id-token: write # to verify the deployment originates from an appropriate source
71+
72+
environment:
73+
name: github-pages
74+
url: ${{ steps.deployment.outputs.page_url }}
75+
76+
runs-on: ubuntu-latest
77+
if: github.event.repository.fork == false
78+
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v4
82+
with:
83+
ref: 'gh-pages'
84+
85+
- name: Setup Pages
86+
uses: actions/configure-pages@v5
87+
88+
- name: Upload artifact
89+
uses: actions/upload-pages-artifact@v3
90+
with:
91+
# Upload entire repository
92+
path: '.'
93+
94+
- name: Deploy to GitHub Pages
95+
id: deployment
96+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)