1
+ name : deploy-book
2
+
3
+ # Run this when the master or main branch changes
4
+ on :
5
+ push :
6
+ branches :
7
+ - main
8
+ # If your git repository has the Jupyter Book within some-subfolder next to
9
+ # unrelated files, you can make this run only if a file within that specific
10
+ # folder has been modified.
11
+ #
12
+ # paths:
13
+ # - some-subfolder/**
14
+
15
+ # Allows you to run this workflow manually from the Actions tab
16
+ workflow_dispatch :
17
+
18
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
19
+ permissions :
20
+ contents : read
21
+ pages : write
22
+ id-token : write
23
+
24
+ # Allow one concurrent deployment, cancelling any in-progress deployments
25
+ # This is useful if you are making a lot of changes to the book
26
+ # and don't want to wait for the previous deployment to finish
27
+ concurrency :
28
+ group : " pages"
29
+ cancel-in-progress : true
30
+
31
+ # This job installs dependencies, builds the book, and pushes it to `gh-pages`
32
+ jobs :
33
+ deploy-book :
34
+ runs-on : ubuntu-latest
35
+ permissions :
36
+ pages : write
37
+ id-token : write
38
+ steps :
39
+ - uses : actions/checkout@v4
40
+
41
+ # Install dependencies
42
+ - name : Set up Python 3.11
43
+ uses : actions/setup-python@v5
44
+ with :
45
+ python-version : 3.11
46
+
47
+ - name : Install dependencies
48
+ run : |
49
+ pip install -r jupyter-book
50
+
51
+ # (optional) Cache your executed notebooks between runs
52
+ # if you have config:
53
+ # execute:
54
+ # execute_notebooks: cache
55
+ # - name: cache executed notebooks
56
+ # uses: actions/cache@v3
57
+ # with:
58
+ # path: _build/.jupyter_cache
59
+ # key: jupyter-book-cache-${{ hashFiles('requirements.txt') }}
60
+
61
+ # Build the book
62
+ - name : Build the book
63
+ run : |
64
+ jupyter-book build .
65
+
66
+ # Upload the book's HTML as an artifact
67
+ - name : Upload artifact
68
+ uses : actions/upload-pages-artifact@v3
69
+ with :
70
+ path : " _build/html"
71
+
72
+ # Deploy the book's HTML to GitHub Pages
73
+ - name : Deploy to GitHub Pages
74
+ id : deployment
75
+ uses : actions/deploy-pages@v4
0 commit comments