Skip to content

Commit 431826c

Browse files
authored
English version of Jupyter Book (#17)
Directory changes ----------------- - `docs/` -> `docs/ja/` - `en/` -> `docs/en/` Redirector ---------- 古いURLにアクセスした場合に自動的に `ja/` 以下に誘導します。GitHub Pagesでは完全な301 redirectは出来ないので `<meta refresh>` で遷移します。`docs/redirect` にHTMLが置いてあり、Actionsで統合されます。 英語版の内容 ---------- そのままにしてあります。変更は次以降のPRで行います。
1 parent 79b2d82 commit 431826c

File tree

68 files changed

+56
-72
lines changed

Some content is hidden

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

68 files changed

+56
-72
lines changed

.github/workflows/docs.yml

Lines changed: 37 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,107 +7,66 @@ on:
77
pull_request:
88
workflow_dispatch:
99

10-
permissions:
11-
contents: read
12-
pages: write
13-
id-token: write
14-
15-
concurrency:
16-
group: "pages"
17-
cancel-in-progress: false
18-
1910
jobs:
20-
docs:
11+
book:
2112
strategy:
2213
matrix:
23-
python-version:
24-
- "3.9"
25-
os:
26-
- ubuntu-latest
27-
runs-on: ${{ matrix.os }}
14+
lang:
15+
- ja
16+
- en
17+
runs-on: ubuntu-24.04
2818
steps:
2919
- name: Checkout
3020
uses: actions/checkout@v4
3121

3222
- name: Install uv
3323
uses: astral-sh/setup-uv@v3
24+
with:
25+
enable-cache: true
3426

35-
- name: Set up Python
36-
run: uv python install ${{ matrix.python-version }}
37-
38-
- name: Install dependencies
39-
run: uv sync --all-extras --dev
27+
- name: Set up Python and dependencies
28+
run: |
29+
uv python install 3.9
30+
uv sync --all-extras --dev
4031
4132
- name: Build the book
4233
run: |
43-
uv run jupyter-book build docs
44-
ERROR_LOGS=$(find docs/_build -type f -name "*.err.log")
34+
uv run jupyter-book build docs/${{ matrix.lang }}
35+
ERROR_LOGS=$(find docs/${{ matrix.lang }}/_build -type f -name "*.err.log")
4536
if [ -n "$ERROR_LOGS" ]; then while IFS= read -r log; do echo "[ERROR LOG] $log" && cat "$log"; done <<< "$ERROR_LOGS" && exit 1; fi
4637
4738
- name: Upload HTML
4839
uses: actions/upload-artifact@v4
4940
with:
50-
name: docs
51-
path: ./docs/_build/html
41+
name: docs-${{ matrix.lang }}
42+
path: ./docs/${{ matrix.lang }}/_build/html
5243
retention-days: 30
5344

54-
- name: Upload API ref
55-
uses: actions/upload-artifact@v4
56-
with:
57-
name: api
58-
path: ./apis
59-
retention-days: 30
60-
en:
61-
strategy:
62-
matrix:
63-
python-version:
64-
- "3.9"
65-
os:
66-
- ubuntu-latest
67-
runs-on: ${{ matrix.os }}
45+
package:
46+
needs: book
47+
runs-on: ubuntu-latest
6848
steps:
6949
- name: Checkout
7050
uses: actions/checkout@v4
7151

72-
- name: Install uv
73-
uses: astral-sh/setup-uv@v3
74-
75-
- name: Set up Python
76-
run: uv python install ${{ matrix.python-version }}
77-
78-
- name: Install dependencies
79-
run: uv sync --all-extras --dev
52+
- name: API reference
53+
run: |
54+
mkdir -p package
55+
mv apis package
8056
81-
- name: Build the book
82-
run: uv run jupyter-book build en
83-
84-
- name: Upload HTML
85-
uses: actions/upload-artifact@v4
86-
with:
87-
name: en
88-
path: ./en/_build/html
89-
retention-days: 30
57+
- name: Setup redirect
58+
run: mv docs/redirect/* package/
9059

91-
package:
92-
needs: [docs, en]
93-
runs-on: ubuntu-latest
94-
steps:
9560
- name: Download HTML of docs
9661
uses: actions/download-artifact@v4
9762
with:
98-
name: docs
99-
path: ./package
100-
101-
- name: Download HTML of api reference
102-
uses: actions/download-artifact@v4
103-
with:
104-
name: api
105-
path: ./package/apis
63+
name: docs-ja
64+
path: ./package/ja
10665

10766
- name: Download HTML of en
10867
uses: actions/download-artifact@v4
10968
with:
110-
name: en
69+
name: docs-en
11170
path: ./package/en
11271

11372
- name: Upload Docs Package
@@ -118,6 +77,15 @@ jobs:
11877
retention-days: 30
11978

12079
deploy:
80+
permissions:
81+
contents: read
82+
pages: write
83+
id-token: write
84+
85+
concurrency:
86+
group: "pages"
87+
cancel-in-progress: false
88+
12189
if: github.ref == 'refs/heads/main'
12290
needs: package
12391
environment:
@@ -130,7 +98,7 @@ jobs:
13098
with:
13199
name: package
132100
path: .
133-
101+
134102
- name: Setup Pages
135103
uses: actions/configure-pages@v5
136104

.github/workflows/python.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@ jobs:
3838
run: uv sync --all-extras --dev
3939

4040
- name: Run tests
41-
run: |
41+
run: |
4242
uv run jupyter nbconvert --execute --to notebook --inplace docs/**/*.ipynb
43-
uv run jupyter nbconvert --execute --to notebook --inplace en/**/*.ipynb

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,5 @@ cython_debug/
163163

164164
.DS_Store
165165

166-
en/_build/
166+
# Jupyter book
167+
_build/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/redirect/getting_started.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=ja/getting_started.html" />

docs/redirect/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=ja/index.html" />

docs/redirect/introduction.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=ja/introduction.html" />

docs/redirect/quickstart/openjij.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/quickstart/openjij.html" />

docs/redirect/quickstart/scip.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/quickstart/scip.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/references/cheat_sheet.html" />

docs/redirect/references/tips.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/references/tips.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/releases/jijmodeling-1.10.0.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/releases/jijmodeling-1.10.1.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/releases/jijmodeling-1.11.0.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/releases/jijmodeling-1.8.0.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/releases/jijmodeling-1.9.0.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/tutorials/constraint_and_penalty.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/tutorials/creating_models.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/tutorials/expressions.html" />
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<meta http-equiv="Refresh" content="0; url=../ja/tutorials/types_and_bounds.html" />

0 commit comments

Comments
 (0)