Skip to content

Commit 742adf0

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

File tree

1 file changed

+93
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)