Skip to content

Commit 6cd7158

Browse files
committed
Add docs to GitHub pages.
1 parent 744449c commit 6cd7158

File tree

3 files changed

+60
-9
lines changed

3 files changed

+60
-9
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy MkDocs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- 'mkdocs.yml'
10+
- 'README.md'
11+
- '.github/workflows/deploy-docs.yml'
12+
13+
permissions:
14+
contents: write
15+
pages: write
16+
id-token: write
17+
18+
jobs:
19+
deploy:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v3
32+
33+
- name: Install dependencies
34+
run: |
35+
uv venv
36+
source .venv/bin/activate
37+
uv pip install -e .
38+
39+
- name: Install Cairo dependencies (for social cards)
40+
run: |
41+
sudo apt-get update
42+
sudo apt-get install -y libcairo2-dev libpango1.0-dev
43+
44+
- name: Build and deploy docs
45+
run: |
46+
source .venv/bin/activate
47+
uv run mkdocs gh-deploy --force

scripts/hook_add_logo_to_social_cards.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Script to manually add the Pioneers Hub logo to the social cards of website.
33
This is not supported by the open version of mkdocs-material, yet.
44
"""
5+
56
from pathlib import Path
67

78
from PIL import Image
@@ -17,12 +18,12 @@ def on_post_build(config):
1718
the_logo_position = (960, 450)
1819
base_width = 175
1920
ph_logo = Image.open(path_to_logo)
20-
w_percent = (base_width / ph_logo.size[0])
21+
w_percent = base_width / ph_logo.size[0]
2122
h_size = int(float(ph_logo.size[1]) * float(w_percent))
2223
ph_logo = ph_logo.resize((base_width, h_size), Image.Resampling.LANCZOS)
23-
for k, dir_from_project_root in xtra["social_cards"]["dirs"].items():
24+
for _, dir_from_project_root in xtra["social_cards"]["dirs"].items():
2425
read_dir = root / dir_from_project_root
25-
for social_card in read_dir.glob('*.png'):
26+
for social_card in read_dir.glob("*.png"):
2627
# Get the social card image
2728
social_card_image = Image.open(social_card)
2829
# Paste the Pioneers Hub logo onto the social card image

scripts/hook_copyright_year.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
""" Alter config on run
2-
https://www.mkdocs.org/user-guide/configuration/#hooks
3-
"""
1+
"""Alter config on run
2+
https://www.mkdocs.org/user-guide/configuration/#hooks
3+
"""
4+
45
from datetime import datetime
56

67

7-
def on_config(config, **kwargs):
8+
def on_config(config, **kwargs): # noqa ARG001
89
config.copyright = f"Copyright © {datetime.now().year} Your Name"
9-
config.copyright = (f'Copyright © 2024{"-" + str(datetime.now().year) if datetime.now().year > 2024 else ""} Pioneers Hub gGmbH – '
10-
f'<a href="#__consent">Change cookie settings</a>')
10+
config.copyright = (
11+
f"Copyright © 2024{'-' + str(datetime.now().year) if datetime.now().year > 2024 else ''} Pioneers Hub gGmbH – " # noqa: PLR2004
12+
f'<a href="#__consent">Change cookie settings</a>'
13+
)

0 commit comments

Comments
 (0)