Skip to content

Commit 8ee4ada

Browse files
Merge pull request #118 from coding-for-reproducible-research/berrli-patch-1
Separate out the GitHub action to have a build.yml and deploy.yml
2 parents 63ff83b + 63d2a69 commit 8ee4ada

File tree

2 files changed

+39
-31
lines changed

2 files changed

+39
-31
lines changed

.github/workflows/build-book.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build Book
2+
3+
# Run this on pull requests
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build-book:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
# Install dependencies
16+
- name: Set up Python 3.11
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: 3.11
20+
21+
- name: Install dependencies
22+
run: |
23+
pip install -r requirements.txt
24+
25+
# (optional) Cache your executed notebooks between runs
26+
- name: Cache executed notebooks
27+
uses: actions/cache@v3
28+
with:
29+
path: _build/.jupyter_cache
30+
key: jupyter-book-cache-${{ hashFiles('requirements.txt') }}
31+
32+
# Build the book
33+
- name: Build the book
34+
run: |
35+
jupyter-book build .
Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
name: deploy-book
1+
name: Deploy Book
22

3-
# Run this on push to main branches and on pull requests
3+
# Run this on push to main branch
44
on:
55
push:
66
branches:
77
- main
8-
pull_request:
9-
branches:
10-
- main
118

12-
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
139
jobs:
14-
build-book:
10+
deploy-book:
1511
runs-on: ubuntu-latest
1612
permissions:
1713
pages: write
@@ -30,9 +26,6 @@ jobs:
3026
pip install -r requirements.txt
3127
3228
# (optional) Cache your executed notebooks between runs
33-
# if you have config:
34-
# execute:
35-
# execute_notebooks: cache
3629
- name: Cache executed notebooks
3730
uses: actions/cache@v3
3831
with:
@@ -46,31 +39,11 @@ jobs:
4639
4740
# Upload the book's HTML as an artifact
4841
- name: Upload artifact
49-
uses: actions/upload-artifact@v3
50-
with:
51-
name: jupyter-book-html
52-
path: "_build/html"
53-
54-
deploy-book:
55-
needs: build-book
56-
runs-on: ubuntu-latest
57-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
58-
permissions:
59-
pages: write
60-
id-token: write
61-
steps:
62-
- uses: actions/checkout@v3
63-
64-
# Download the built book artifact
65-
- name: Download artifact
66-
uses: actions/download-artifact@v3
42+
uses: actions/upload-pages-artifact@v2
6743
with:
68-
name: jupyter-book-html
6944
path: "_build/html"
7045

7146
# Deploy the book's HTML to GitHub Pages
7247
- name: Deploy to GitHub Pages
7348
id: deployment
7449
uses: actions/deploy-pages@v2
75-
with:
76-
path: "_build/html"

0 commit comments

Comments
 (0)