Skip to content

Commit 63ff83b

Browse files
Merge pull request #117 from coding-for-reproducible-research/refactored-github-action
Seperate out building and deploying of juypter book in github action
2 parents 9d6e7e4 + 06eae32 commit 63ff83b

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: deploy-book
22

3-
# Run this on push to master/main branches and on pull requests
3+
# Run this on push to main branches and on pull requests
44
on:
55
push:
66
branches:
@@ -11,7 +11,7 @@ on:
1111

1212
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
1313
jobs:
14-
deploy-book:
14+
build-book:
1515
runs-on: ubuntu-latest
1616
permissions:
1717
pages: write
@@ -33,7 +33,7 @@ jobs:
3333
# if you have config:
3434
# execute:
3535
# execute_notebooks: cache
36-
- name: cache executed notebooks
36+
- name: Cache executed notebooks
3737
uses: actions/cache@v3
3838
with:
3939
path: _build/.jupyter_cache
@@ -46,11 +46,31 @@ jobs:
4646
4747
# Upload the book's HTML as an artifact
4848
- name: Upload artifact
49-
uses: actions/upload-pages-artifact@v2
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
5067
with:
68+
name: jupyter-book-html
5169
path: "_build/html"
5270

5371
# Deploy the book's HTML to GitHub Pages
5472
- name: Deploy to GitHub Pages
5573
id: deployment
5674
uses: actions/deploy-pages@v2
75+
with:
76+
path: "_build/html"

0 commit comments

Comments
 (0)