Skip to content

Commit 82c453d

Browse files
authored
[DOCS] [1.21.1] Use mike for multi-version support (#4314)
1 parent 46485f6 commit 82c453d

File tree

5 files changed

+21
-32
lines changed

5 files changed

+21
-32
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ name: Publish docs via GitHub Pages
22
on:
33
workflow_dispatch:
44
push:
5-
branches: [1.20.1]
5+
branches: ["1.20.1", "1.21"]
66
paths: ['docs/**']
77

88
permissions:
9-
contents: read
10-
pages: write
11-
id-token: write
9+
contents: write
1210

1311
concurrency:
1412
group: 'pages'
@@ -24,33 +22,17 @@ jobs:
2422
steps:
2523
- uses: actions/checkout@v4
2624
with:
27-
ref: '1.20.1'
28-
sparse-checkout: './docs'
25+
ref: '${{ github.ref_name }}'
26+
fetch-depth: 0
2927
- uses: actions/setup-python@v4
3028
with:
3129
python-version: '3.11'
3230
cache: 'pip'
33-
- run: pip install -r ./requirements.txt
34-
- uses: actions/cache@v4
35-
with:
36-
key: 'mkdocs-cache'
37-
path: './docs/.cache'
38-
- name: Build static files
39-
id: mkdocs
40-
run: mkdocs build
41-
- name: Upload pages as artifact
42-
id: artifact
43-
uses: actions/upload-pages-artifact@v3
44-
with:
45-
path: './docs/site/'
46-
47-
deploy:
48-
runs-on: ubuntu-latest
49-
needs: build
50-
environment:
51-
name: github-pages
52-
url: ${{ steps.deployment.outputs.page_url }}
53-
steps:
54-
- name: Deploy Pages
55-
id: deployment
56-
uses: actions/deploy-pages@v4
31+
- name: Install packages
32+
run: pip install -r ./requirements.txt
33+
- name: Set git username and password
34+
run: git config user.name 'github-actions[bot]'; git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
35+
- name: Deploy pages to gh-pages branch
36+
run: mike deploy "${{ github.ref_name }}" --push
37+
- name: Ensure 1.20.1 is the default version
38+
run: mike set-default 1.20.1 --push

docs/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@ To install the required dependencies, please run `pip install -r requirements.tx
3535
The following plugins for MkDocs are being used:
3636
- https://squidfunk.github.io/mkdocs-material/
3737
- https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin
38+
39+
## Deployment
40+
The hosted documentation is found on the `gh-pages` branch of the repository. [Mike](https://github.com/jimporter/mike) is used to deploy both the 1.20.1 and 1.21.1 documentation on the same site through Github Actions.
41+
42+
When working on the docs locally, the plain `mkdocs` commands should be used to view the changes made to the version of the docs you are currently working on, like the previously mentioned `mkdocs serve`.

docs/content/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ hide:
55
title: Home
66
---
77

8-
9-
# Welcome to GregTech CEu Modern's Documentation!
8+
# Welcome to GregTech CEu Modern's Documentation for 1.21.1!
109

1110
GregTech CEu Modern is a port of [GregTech Community Edition Unofficial](https://github.com/GregTechCEu/GregTech)
1211
to modern Minecraft versions.

docs/mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ extra_css:
4747
- stylesheets/extra.css
4848

4949
extra:
50+
version:
51+
provider: mike
5052
social:
5153
- icon: fontawesome/brands/discord
5254
link: https://discord.gg/bWSWuYvURP

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
mkdocs-material
22
mkdocs-awesome-pages-plugin
3+
mike

0 commit comments

Comments
 (0)