diff --git a/.github/workflows/ExportPluto.yaml b/.github/workflows/ExportPluto.yaml new file mode 100644 index 00000000..5a358d92 --- /dev/null +++ b/.github/workflows/ExportPluto.yaml @@ -0,0 +1,59 @@ +name: Export Pluto notebooks +on: + push: + paths-ignore: + - "README.md" + branches: + - main + - master + workflow_dispatch: + +# When two jobs run in parallel, cancel the older ones, to make sure that the website is generated from the most recent commit. +concurrency: + group: pluto-export + cancel-in-progress: true + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout this repository + uses: actions/checkout@v2 + + - name: Install Julia + uses: julia-actions/setup-julia@v1 + with: + version: 1.8 + + - name: Cache Julia artifacts & such + uses: julia-actions/cache@v1 + with: + cache-registries: "true" + + # 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. + - name: Set up notebook state cache + uses: actions/cache@v3 + with: + path: pluto_state_cache + key: ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }}-${{ hashFiles('**/*jl') }} + restore-keys: | + ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml', '.github/workflows/*' ) }} + + + - name: Run & export Pluto notebooks + run: | + julia -e 'using Pkg + Pkg.activate("pluto-slider-server-environment") + Pkg.instantiate() + + import PlutoSliderServer + + PlutoSliderServer.github_action("."; Export_cache_dir="pluto_state_cache")' + + + - name: Deploy to gh-pages + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: .