Skip to content

Commit 6f8eaf2

Browse files
authored
Create ExportPluto.yaml
1 parent 64001bc commit 6f8eaf2

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/ExportPluto.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Export Pluto notebooks
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- master
7+
workflow_dispatch:
8+
9+
# When two jobs run in parallel, cancel the older ones, to make sure that the website is generated from the most recent commit.
10+
concurrency:
11+
group: pluto-export
12+
cancel-in-progress: true
13+
14+
# This action needs permission to write the exported HTML file to the gh-pages branch.
15+
permissions:
16+
contents: write
17+
# (all other permission fields default to "none")
18+
19+
jobs:
20+
build-and-deploy:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout this repository
24+
uses: actions/checkout@v4
25+
26+
- name: Install Julia
27+
uses: julia-actions/setup-julia@v2
28+
with:
29+
version: "1" # This will automatically pick the latest Julia version
30+
31+
- name: Cache Julia artifacts & such
32+
uses: julia-actions/cache@v2
33+
with:
34+
cache-registries: "true"
35+
36+
# We set up a folder that Pluto can use to cache exported notebooks. If the notebook file did not change, then Pluto can take the exported file from cache instead of running the notebook.
37+
- name: Set up notebook state cache
38+
uses: actions/cache@v4
39+
with:
40+
path: pluto_state_cache
41+
key: ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}-${{ hashFiles('**/*jl') }}
42+
restore-keys: |
43+
${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}
44+
45+
- name: Ignore notebook state cache in export
46+
run: echo 'pluto_state_cache' >> .gitignore
47+
48+
- name: Run & export Pluto notebooks
49+
run: |
50+
julia -e 'using Pkg
51+
Pkg.activate(mktempdir())
52+
Pkg.add([
53+
Pkg.PackageSpec(name="PlutoSliderServer", version="1"),
54+
])
55+
56+
import PlutoSliderServer
57+
58+
PlutoSliderServer.github_action(".";
59+
Export_cache_dir="pluto_state_cache",
60+
Export_baked_notebookfile=false,
61+
Export_baked_state=false,
62+
# more parameters can go here
63+
)'
64+
65+
66+
- name: Deploy to gh-pages
67+
uses: JamesIves/github-pages-deploy-action@releases/v4
68+
with:
69+
token: ${{ secrets.GITHUB_TOKEN }}
70+
branch: gh-pages
71+
folder: .
72+
single-commit: true

0 commit comments

Comments
 (0)