File tree 1 file changed +54
-0
lines changed 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish JupyterBook to GitHub Pages
2
+
3
+ on :
4
+ workflow_run :
5
+ workflows : ["Sync JupyterBook"] # Must match the exact name of your sync workflow
6
+ types : [completed]
7
+ workflow_dispatch :
8
+
9
+ jobs :
10
+ build :
11
+ runs-on : ubuntu-latest
12
+
13
+ steps :
14
+ # 1) Check out the jupyterbook branch to build from
15
+ - uses : actions/checkout@v2
16
+ with :
17
+ ref : jupyterbook
18
+
19
+ # 2) Set up Python
20
+ - name : Set up Python
21
+ uses : actions/setup-python@v1
22
+ with :
23
+ python-version : 3.9
24
+
25
+ # 3) Install Python dependencies
26
+ - name : Install Python dependencies
27
+ run : |
28
+ sudo apt-get update
29
+ sudo apt-get install -y python3-pip
30
+ pip install jupyter-book ghp-import pyleoclim
31
+ # This ensures ~/.local/bin is on PATH:
32
+ PATH="${PATH}:${HOME}/.local/bin"
33
+
34
+ # 4) (Optional) Build the TOC (only needed if you rely on jupyter-book toc .)
35
+ - name : Build book TOC file
36
+ run : |
37
+ jupyter-book toc .
38
+
39
+ # 5) Build book HTML
40
+ - name : Build book HTML
41
+ run : |
42
+ jupyter-book build .
43
+
44
+ # 6) Deploy _build/html to gh-pages
45
+ - name : Push _build/html to gh-pages
46
+ run : |
47
+ # Fix any permissions issues
48
+ sudo chown -R $(whoami):$(whoami) .
49
+ # Configure git
50
+ git config --global user.email "${{ github.actor }}@users.noreply.github.com"
51
+ git config --global user.name "${{ github.actor }}"
52
+ git remote set-url origin "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY"
53
+ # Use ghp-import to push the HTML build to gh-pages branch
54
+ ghp-import ./_build/html -f -p -n
You can’t perform that action at this time.
0 commit comments