Skip to content

Commit 8475dc9

Browse files
Add mkdocs deployment workflows
1 parent ad88e0b commit 8475dc9

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Generate documentation dryrun
2+
on:
3+
# Documentation can be either manually updated or is automatically updated when pushed to main branch
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- '*'
8+
- '!main'
9+
10+
jobs:
11+
deploy:
12+
name: Build documentation site
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Checkout repository including submodules
16+
- name: Checkout
17+
id: checkout
18+
uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
22+
# Setup Python
23+
- name: Setup Python
24+
id: python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.9'
28+
29+
# Install dependencies using Poetry
30+
- uses: Gr1N/setup-poetry@v9
31+
- uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/pypoetry/virtualenvs
34+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
35+
- run: poetry --version
36+
- run: poetry install
37+
38+
# Build documentation to ./site/ directory
39+
- name: Build Documentation
40+
id: build
41+
run: poetry run mkdocs build
42+
43+
# Upload build outputs
44+
- name: Upload build artifacts HTML
45+
uses: actions/upload-artifact@v4
46+
if: always()
47+
with:
48+
name: HTML output
49+
path: site/*

.github/workflows/mkdocs.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Generate documentation and deploy to GitHub pages
2+
on:
3+
# Documentation can be either manually updated or is automatically updated when pushed to main branch
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
# Make sure deploy-pages has necessary permissions to deploy to GitHub Pages
10+
permissions:
11+
pages: write
12+
id-token: write
13+
14+
# Cancel older deploy workflow when more than one is running
15+
concurrency:
16+
group: pages
17+
cancel-in-progress: true
18+
19+
jobs:
20+
deploy:
21+
name: Build and deploy documentation site
22+
runs-on: ubuntu-latest
23+
environment:
24+
name: github-pages
25+
url: ${{ steps.deploy.outputs.page_url }} # Output URL after the workflow has finished
26+
steps:
27+
# Checkout repository including submodules
28+
- name: Checkout
29+
id: checkout
30+
uses: actions/checkout@v4
31+
with:
32+
submodules: true
33+
34+
# Setup Python
35+
- name: Setup Python
36+
id: python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.9'
40+
41+
# Install dependencies using Poetry
42+
- uses: Gr1N/setup-poetry@v9
43+
- uses: actions/cache@v4
44+
with:
45+
path: ~/.cache/pypoetry/virtualenvs
46+
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
47+
- run: poetry --version
48+
- run: poetry install
49+
50+
# Build documentation to ./site/ directory
51+
- name: Build Documentation
52+
id: build
53+
run: poetry run mkdocs build
54+
55+
# Upload artifact from the ./site/ directory using the expected format for GitHub Pages
56+
- name: Upload Artifact
57+
id: upload
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: ./site/
61+
62+
# Use previously uploaded artifact to deploy to GitHub Pages
63+
- name: Deploy
64+
id: deploy
65+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)