Fix url #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy site and notebooks | |
on: | |
push: | |
branches: | |
- main | |
- master | |
jobs: | |
build-and-deploy: | |
concurrency: ci-${{ github.ref }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
# NOTE: Python is necessary for the pre-rendering (minification) step | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
# NOTE: Here you can install dependencies such as matplotlib if you use | |
# packages such as PyPlot. | |
- run: pip install matplotlib | |
- name: Install Julia | |
uses: julia-actions/setup-julia@v1 | |
with: | |
version: 1.8 | |
# - name: Cache Julia artifacts | |
# uses: julia-actions/cache@v1 | |
# with: | |
# cache-registries: "false" | |
# 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 Pluto 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/*' ) }} | |
# NOTE | |
# The steps below ensure that NodeJS and Franklin are loaded then it | |
# installs highlight.js which is needed for the prerendering step | |
# (code highlighting + katex prerendering). | |
# Then the environment is activated and instantiated to install all | |
# Julia packages which may be required to successfully build your site. | |
# The last line should be `optimize()` though you may want to give it | |
# specific arguments, see the documentation or ?optimize in the REPL. | |
- run: | | |
julia --color=yes -e ' | |
using Pkg; Pkg.activate("."); Pkg.instantiate(); | |
import PlutoSliderServer | |
PlutoSliderServer.github_action("homework"; | |
Export_cache_dir="pluto_state_cache", | |
Export_create_index=false); | |
PlutoSliderServer.github_action("notes"; | |
Export_cache_dir="pluto_state_cache", | |
Export_create_index=false); | |
import NodeJS | |
NodeJS.run(`$(NodeJS.npm_cmd()) install [email protected]`); | |
import Franklin; | |
Franklin.optimize(prepath="/ubc-cpsc-406-22-23/", minify=false) | |
' | |
env: | |
# Allows the use of unicode characters in Plots.jl | |
GKS_ENCODING: "utf8" | |
# Fixes 'GKS: can't connect to GKS socket application' errors | |
# and quality of output plots in GR back end. | |
GKSwstype: "100" | |
- name: Marp Build (slides folder) | |
uses: docker://marpteam/marp-cli:v2.3.0 | |
with: | |
args: -I slides/ -o __site/slides/ | |
env: | |
MARP_USER: root:root | |
- name: Deploy GitHub Page | |
uses: JamesIves/github-pages-deploy-action@releases/v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: __site | |
single-commit: true | |