Skip to content

Commit ebf1db4

Browse files
authored
Merge pull request #25 from ONS-Innovation/mkdocs_refresh
KEH-893 | MkDocs Refresh
2 parents 6ba39db + 7b3b9cb commit ebf1db4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+34
-17059
lines changed
Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,32 @@
1-
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
3-
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
44
on:
5-
# Runs on pushes targeting the default branch
65
push:
7-
branches: ["main"]
8-
9-
# Allows you to run this workflow manually from the Actions tab
10-
workflow_dispatch:
11-
12-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
6+
branches:
7+
- master
8+
- main
139
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
17-
18-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20-
concurrency:
21-
group: "pages"
22-
cancel-in-progress: false
23-
10+
contents: write
2411
jobs:
25-
# Single deploy job since we're just deploying
2612
deploy:
27-
environment:
28-
name: github-pages
29-
url: ${{ steps.deployment.outputs.page_url }}
3013
runs-on: ubuntu-latest
3114
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
- name: Setup Pages
35-
uses: actions/configure-pages@v5
36-
- name: Upload artifact
37-
uses: actions/upload-pages-artifact@v3
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
3821
with:
39-
# Upload entire repository
40-
path: './mkdocs_deployment'
41-
- name: Deploy to GitHub Pages
42-
id: deployment
43-
uses: actions/deploy-pages@v4
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 -r mkdocs_requirements.txt
32+
- run: mkdocs gh-deploy --force

docs/documentation.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,22 @@ In order to build an MkDocs deployment or serve the documentation locally, we ne
4848
4949
## Updating MkDocs Deployment
5050
51+
### GitHub Action to Deploy Documentation
52+
53+
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.
54+
55+
### Manual Deployment
56+
5157
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:
5258
5359
1. Navigate to the projects root directory.
5460
55-
2. Delete the existing `/mkdocs_deployment` directory.
56-
57-
3. Build the MkDocs deployment.
61+
2. Deploy the documentation to GitHub Pages.
5862
5963
```bash
60-
mkdocs build
64+
mkdocs gh-deploy
6165
```
6266
63-
4. Rename the `/site` directory to `/mkdocs_deployment`. This allows git to track the build so GitHub Pages can redeploy it.
64-
65-
5. Commit and Push changes.
67+
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>/`.
6668
67-
Once completed, a GitHub Action will redeploy the new build to GitHub Pages.
69+
**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.

0 commit comments

Comments
 (0)