Skip to content

Commit 131019b

Browse files
committed
Add an action to export notebooks to GitHub pages
1 parent c0be827 commit 131019b

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.github/workflows/ExportPluto.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Adapted from https://github.com/JuliaPluto/static-export-template
2+
name: Export Pluto notebooks to GitHub pages
3+
4+
on:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: pluto-export
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build-and-deploy:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout this repository
21+
uses: actions/checkout@v4
22+
23+
- name: Install Julia
24+
uses: julia-actions/setup-julia@v2
25+
26+
- name: Cache Julia depot
27+
uses: julia-actions/cache@v2
28+
29+
- name: Set up notebook state cache
30+
uses: actions/cache@v4
31+
with:
32+
path: cache
33+
key: ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}-${{ hashFiles('**/*jl') }}
34+
restore-keys: |
35+
${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}
36+
37+
- name: Export Pluto notebooks to HTML
38+
run: make pkg_instantiate build
39+
40+
- name: Deploy to gh-pages
41+
uses: JamesIves/github-pages-deploy-action@v4
42+
with:
43+
folder: build
44+
single-commit: true

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ serve: #: start HTTP server for exported HTML
1919
python -m http.server -d build
2020
.PHONY: serve
2121

22+
pkg_instantiate: #: instantiate the project
23+
julia --project -e 'using Pkg; Pkg.instantiate()'
24+
.PHONY: pkg_instantiate
25+
2226
pkg_update: #: update Julia project dependencies
23-
julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.update();'
27+
julia --project -e 'using Pkg; Pkg.update()'
2428
.PHONY: pkg_update

0 commit comments

Comments
 (0)