Skip to content

Commit 4ca8116

Browse files
committed
Start mkdocs implementation
1 parent e45b50a commit 4ca8116

9 files changed

Lines changed: 717 additions & 15 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# A GitHub Actions workflow to deploy MkDocs documentation to GitHub Pages on push to the master or main branch.
2+
---
3+
name: Deploy MkDocs
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
permissions:
10+
contents: write
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Configure Git Credentials
17+
run: |
18+
git config user.name github-actions[bot]
19+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.x
23+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
24+
- uses: actions/cache@v4
25+
with:
26+
key: mkdocs-material-${{ env.cache_id }}
27+
path: .cache
28+
restore-keys: |
29+
mkdocs-material-
30+
- run: pip install mkdocs-material
31+
- run: pip install poetry
32+
- run: poetry install --only docs
33+
- run: mkdocs gh-deploy --force

.mega-linter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ DISABLE_LINTERS:
3535
- TERRAFORM_TFLINT
3636
- TERRAFORM_TERRASCAN
3737

38+
# Disable due to poor configuration options
39+
- ACTION_ACTIONLINT
40+
3841
SHOW_ELAPSED_TIME: true
3942

4043
FILEIO_REPORTER: false

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ install: ## Install the dependencies excluding dev.
4343
install-dev: ## Install the dependencies including dev.
4444
poetry install
4545

46+
.PHONY: install-docs
47+
install-docs: ## Install only the documentation dependencies
48+
poetry install --only docs
49+
4650
.PHONY: megalint
4751
megalint: ## Run the mega-linter.
4852
docker run --platform linux/amd64 --rm \

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ A Python utility used to archive old, unused GitHub repositories from an organis
88
- [Table of Contents](#table-of-contents)
99
- [Prerequisites](#prerequisites)
1010
- [Makefile](#makefile)
11+
- [Documentation](#documentation)
1112
- [Development](#development)
1213
- [Running the Project](#running-the-project)
1314
- [Containerised (Recommended)](#containerised-recommended)
@@ -45,6 +46,24 @@ This repository makes use of a Makefile to execute common commands. To view all
4546
make all
4647
```
4748

49+
## Documentation
50+
51+
This project uses [MkDocs](https://www.mkdocs.org/) for documentation. The documentation is located in the `docs` directory. To view the documentation locally, you can run the following commands:
52+
53+
1. Install MkDocs and its dependencies:
54+
55+
```bash
56+
make install-docs
57+
```
58+
59+
2. Serve the documentation locally:
60+
61+
```bash
62+
mkdocs serve
63+
```
64+
65+
3. Open your web browser and navigate to `http://localhost:8000`.
66+
4867
## Development
4968

5069
To work on this project, you need to:

docs/documentation.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Documentation
2+
3+
This site uses MkDocs to build its documentation and GitHub Pages for hosting.
4+
5+
## Format
6+
7+
Documentation within this project follows the following pattern:
8+
9+
- A `README.md` for each component
10+
- A `/docs` folder for the project
11+
12+
Each `README.md` should contain:
13+
14+
- A description of what the component is/does
15+
- A list of any prerequisites
16+
- Setup instructions
17+
- Execution instructions
18+
- Deployment instructions
19+
20+
The `/docs` folder should contain:
21+
22+
- A description of what the project is
23+
- An overview of how the everything fits together in the project
24+
- An explanation of the tech stack
25+
- Details of the underlying dataset
26+
27+
A majority of the information should reside within the `/docs` directory over the `README`. The `README`s in this project should be kept for concise instructions on how to use each component. Any detailed explanation should be kept within `/docs`.
28+
29+
## Getting MkDocs Setup
30+
31+
In order to build an MkDocs deployment or serve the documentation locally, we need to install MkDocs and its dependencies.
32+
33+
1. Navigate into the project's root directory.
34+
35+
2. Install MkDocs and its dependencies.
36+
37+
```bash
38+
make install-docs
39+
```
40+
41+
3. You can now use MkDocs. To see a list of commands run the following:
42+
43+
```bash
44+
mkdocs --help
45+
```
46+
47+
## Updating MkDocs Deployment
48+
49+
### GitHub Action to Deploy Documentation
50+
51+
A GitHub Action is set up to automatically deploy the documentation to GitHub Pages whenever a commit is made to the `main` branch. This action is triggered by a push event to the `main` branch and runs the `mkdocs gh-deploy` command to build and deploy the documentation.
52+
53+
### Manual Deployment
54+
55+
If changes are made within `/docs`, the GitHub Pages deployment will need to be updated. Assuming you have already installed [MkDocs](https://www.mkdocs.org/getting-started/#installation) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/getting-started/#installation), do the following:
56+
57+
1. Navigate to the projects root directory.
58+
59+
2. Deploy the documentation to GitHub Pages.
60+
61+
```bash
62+
mkdocs gh-deploy
63+
```
64+
65+
3. This will build the documentation and deploy it to the `gh-pages` branch of your repository. The documentation will be available at `https://ONS-Innovation.github.io/<repository-name>/`.
66+
67+
**Please Note:** The `gh-deploy` command will overwrite the `gh-pages` branch and make the local changes available on GitHub Pages. Make sure that these changes are appropriate and have been reviewed before deployment.

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# GitHub Repository Archive Script

mkdocs.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
site_name: GitHub Repository Archive Script
2+
3+
repo_url: https://github.com/ONS-Innovation/github-repository-archive-script
4+
repo_name: GitHub Repository Archive Script
5+
6+
nav:
7+
- Home: "index.md"
8+
- FAQ: "faq.md"
9+
- Documentation: "documentation.md"
10+
- Technical Documentation:
11+
- Overview: "technical-documentation/overview.md"
12+
- The Process: "technical-documentation/the-process.md"
13+
- Configuration: "technical-documentation/configuration.md"
14+
- Notification Issue: "technical-documentation/notification-issue.md"
15+
- Logging: "technical-documentation/logging.md"
16+
17+
theme:
18+
name: material
19+
language: en
20+
21+
palette:
22+
# toggle for light mode
23+
- media: "(prefers-color-scheme: light)"
24+
scheme: default
25+
primary: white
26+
accent: deep purple
27+
toggle:
28+
icon: material/weather-night
29+
name: Switch to dark mode
30+
31+
# toggle for dark mode
32+
- media: "(prefers-color-scheme: dark)"
33+
scheme: slate
34+
primary: white
35+
accent: deep purple
36+
toggle:
37+
icon: material/weather-sunny
38+
name: Switch to system preference
39+
40+
features:
41+
- navigation.tracking
42+
- navigation.sections
43+
- navigation.path
44+
- navigation.top
45+
- navigation.footer
46+
47+
- search.suggest
48+
49+
- header.autohide
50+
- content.code.copy
51+
52+
logo: assets/logo.png
53+
favicon: assets/favicon.ico
54+
55+
icon:
56+
repo: fontawesome/brands/github
57+
58+
markdown_extensions:
59+
- pymdownx.highlight:
60+
anchor_linenums: true
61+
line_spans: __span
62+
pygments_lang_class: true
63+
- pymdownx.inlinehilite
64+
- pymdownx.snippets
65+
- pymdownx.superfences
66+
- attr_list
67+
- pymdownx.emoji:
68+
emoji_index: !!python/name:material.extensions.emoji.twemoji
69+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
70+
- pymdownx.superfences:
71+
custom_fences:
72+
- name: mermaid
73+
class: mermaid
74+
format: !!python/name:pymdownx.superfences.fence_code_format
75+
76+
plugins:
77+
- search
78+
- mkdocstrings:
79+
default_handler: python

0 commit comments

Comments
 (0)