Skip to content

Commit eac3f5e

Browse files
authored
Merge pull request #51 from nims-dpfc/develop/1
Develop/1: ドキュメントのバージョン切り替え
2 parents 6303f48 + 3c86deb commit eac3f5e

File tree

4 files changed

+100
-6
lines changed

4 files changed

+100
-6
lines changed

.github/workflows/docs-ci-dry-run.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test Documentation Build and Deploy
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- master
7+
- main
8+
pull_request:
9+
branches:
10+
- "*"
11+
12+
jobs:
13+
test-deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Configure Git Credentials
21+
run: |
22+
git config user.name github-actions[bot]
23+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.10"
28+
29+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
30+
31+
- uses: actions/cache@v4
32+
with:
33+
key: mkdocs-material-${{ env.cache_id }}
34+
path: .cache
35+
restore-keys: |
36+
mkdocs-material-
37+
38+
- name: Install dependencies and Deploy
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install -r requirements-dev.lock
42+
43+
- name: Test documentation build
44+
run: mkdocs build
45+
46+
- name: Test full deployment process
47+
run: |
48+
# Simulate tag deployment
49+
mike deploy test-version latest --allow-empty
50+
51+
# Simulate dev deployment
52+
mike deploy dev --allow-empty
53+
54+
# Check the current state
55+
git status
56+
git log --oneline -n 5
57+
58+
- name: Cleanup
59+
run: |
60+
git checkout ${{ github.ref }}
61+
git branch -D gh-pages

.github/workflows/docs-ci.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,58 @@ on:
44
branches:
55
- master
66
- main
7+
tags:
8+
- "v*.*.*"
9+
710
permissions:
811
contents: write
12+
913
jobs:
1014
deploy:
1115
runs-on: ubuntu-latest
1216
steps:
1317
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
1421
- name: Configure Git Credentials
1522
run: |
1623
git config user.name github-actions[bot]
1724
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
25+
1826
- uses: actions/setup-python@v5
1927
with:
2028
python-version: "3.10"
29+
2130
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
31+
2232
- uses: actions/cache@v4
2333
with:
2434
key: mkdocs-material-${{ env.cache_id }}
2535
path: .cache
2636
restore-keys: |
2737
mkdocs-material-
38+
2839
- name: Install dependencies and Deploy
2940
run: |
3041
python -m pip install --upgrade pip
3142
pip install -r requirements-dev.lock
32-
- name: Fetch gh-pages branch
33-
run: |
34-
git fetch origin gh-pages:gh-pages
3543
36-
- name: Deploy HTML files
37-
run: mkdocs gh-deploy --force
44+
# - name: Fetch gh-pages branch
45+
# run: |
46+
# git fetch origin gh-pages:gh-pages
47+
48+
# - name: Deploy HTML files
49+
# run: mkdocs gh-deploy --force
50+
51+
- name: Deploy documentation
52+
run: |
53+
if [[ ${{ github.ref }} =~ ^refs/tags/ ]]; then
54+
# push tag
55+
VERSION=${GITHUB_REF#refs/tags/}
56+
mike deploy --push --update-aliases $VERSION latest
57+
mike set-default --push latest
58+
else
59+
# push to main/master branch
60+
mike deploy --push --update-aliases dev
61+
fi

mkdocs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ plugins:
8484
show_inheritance_diagram: true
8585
heading_level: 3
8686
show_root_toc_entry: false
87+
- mike:
88+
# These fields are all optional; the defaults are as below...
89+
alias_type: symlink
90+
redirect_template: null
91+
deploy_prefix: ''
92+
canonical_version: null
93+
version_selector: true
94+
css_dir: css
95+
javascript_dir: js
8796

8897
watch:
8998
- src

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,5 +203,5 @@ dev-dependencies = [
203203
"mkdocs-mermaid2-plugin>=1.1.1",
204204
"ruff>=0.5.5",
205205
"jsonschema-markdown>=0.3.8",
206-
"mike>=2.1.1",
206+
"mike>=2.1.3",
207207
]

0 commit comments

Comments
 (0)