re-structure readme #344
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Fix URLs for PR preview deployment (pull request previews) | |
if: github.event_name == 'pull_request' | |
run: | # "previews" below is the folder name where your PR previews are stored | |
echo "PREVIEW_FRANKLIN_WEBSITE_URL=https://s-ccs.github.io/previews/PR${{ github.event.number }}/" >> $GITHUB_ENV | |
echo "PREVIEW_FRANKLIN_PREPATH=previews/PR${{ github.event.number }}" >> $GITHUB_ENV | |
# NOTE: Python is necessary for the pre-rendering (minification) step | |
- name: Install python | |
uses: actions/setup-python@v2 | |
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.6 | |
# 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. | |
# EDIT: Also makes sure to install Franklin and CSV. Also makes sure lune and cheerio arem installed | |
- run: julia -e ' | |
using Pkg; Pkg.activate("."); Pkg.instantiate(); Pkg.add("NodeJS"); Pkg.add("Franklin"); Pkg.add("CSV");Pkg.add("DataStructures"); | |
using NodeJS; run(`$(npm_cmd()) install highlight.js`); | |
run(`$(npm_cmd()) install lunr`); run(`$(npm_cmd()) install cheerio`); | |
include("./_assets/scripts/init_dynamics.jl"); | |
using Franklin; | |
using CSV; | |
lunr(); | |
optimize(clear=true, minify=false) | |
' | |
- name: Build and Deploy | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: __site | |
- name: Deploy (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/v4 | |
with: | |
branch: gh-pages # The branch where your website is deployed | |
folder: __site | |
token: ${{ secrets.GITHUB_TOKEN }} | |
target-folder: "previews/PR${{ github.event.number }}" # The website preview is going to be stored in the previews subfolder | |
- name: Deploy (main) | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages # Replace here the branch where your website is deployed | |
folder: __site | |
clean-exclude: | # This makes sure that the previews are not wiped out during regular builds | |
previews/* |