Skip to content

Merge pull request #23 from navidcy/patch-1 #21

Merge pull request #23 from navidcy/patch-1

Merge pull request #23 from navidcy/patch-1 #21

name: Export Pluto notebooks & Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: export
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: 🙌 Install Julia
uses: julia-actions/setup-julia@v1
with:
version: "1.8"
- name: ⏱ Cache notebook states
uses: actions/cache@v2
with:
path: _cache
key: ${{ runner.os }}-pluto_state_cache-v3-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-pluto_state_cache-v3-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}
- name: ⏱ Cache .julia
uses: actions/cache@v2
with:
path: ~/.julia
key: ${{ runner.os }}-dotjulia-v1-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-dotjulia-v1-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}
- name: 🪴 Generate site
run: julia --project=pluto-deployment-environment -e '
import Pkg;
Pkg.instantiate();
include("./generate.jl")'
- name: 📰 Upload site generation report
uses: actions/upload-artifact@v2
if: always()
with:
path: generation_report.html
- name: 🚀 Deploy to GitHub Pages (main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: _site
CLEAN_EXCLUDE: |
previews/*
- name: Deploy PR preview
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this build is a PR build and the PR is NOT from a fork
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: _site
TARGET_FOLDER: "previews/PR${{ github.event.number }}" # The website preview is going to be stored in the previews subfolder