Skip to content

Commit a1777a2

Browse files
committed
Publish on GitHub pages
1 parent b11d90b commit a1777a2

4 files changed

Lines changed: 93 additions & 1 deletion

File tree

.github/workflows/pages.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy MkDocs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Check out 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 documentation dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install \
34+
mkdocs \
35+
mkdocs-material \
36+
mkdocs-awesome-pages-plugin \
37+
pymdown-extensions
38+
39+
- name: Build site
40+
run: mkdocs build --strict
41+
42+
- name: Upload Pages artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: site
46+
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
needs: build
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ project.mk
1111
vars.mk
1212

1313
site
14+
site/

README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1-
# doc
1+
# Freenit documentation
2+
3+
This repository is prepared for publishing on GitHub Pages with MkDocs.
4+
5+
## Local development
6+
7+
Install the MkDocs dependencies and run:
8+
9+
```sh
10+
mkdocs serve
11+
```
12+
13+
To validate the generated site locally:
14+
15+
```sh
16+
mkdocs build --strict
17+
```
18+
19+
## GitHub Pages deployment
20+
21+
This repository is named `freenit-framework.github.io`, so it behaves like a GitHub user/organization Pages repository.
22+
23+
The MkDocs deployment guide explains that user/organization Pages deployments with `mkdocs gh-deploy` are intended to publish into a dedicated Pages repository/branch separate from the source repository. Because this repository stores the MkDocs source on `master`, deploying the built site back into that same branch with `mkdocs gh-deploy` would be the wrong workflow here.
24+
25+
Instead, publishing is handled by GitHub Actions in [`.github/workflows/pages.yml`](/home/meka/repos/freenit-framework.github.io/.github/workflows/pages.yml). On each push to `master`, the workflow:
26+
27+
1. installs MkDocs and the required plugins,
28+
2. builds the site with `mkdocs build --strict`,
29+
3. deploys the generated `site/` output to GitHub Pages.
30+
31+
## One-time GitHub configuration
32+
33+
In the GitHub repository settings, set Pages to use `GitHub Actions` as the source.

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
site_name: Freenit
2+
site_url: https://freenit-framework.github.io/
3+
repo_url: https://github.com/freenit-framework/freenit-framework.github.io
4+
repo_name: freenit-framework/freenit-framework.github.io
25
theme:
36
name: material
47
logo: img/logo.png

0 commit comments

Comments
 (0)