Skip to content

Merge pull request #42 from OceanGlidersCommunity/MOchiara-patch-1 #109

Merge pull request #42 from OceanGlidersCommunity/MOchiara-patch-1

Merge pull request #42 from OceanGlidersCommunity/MOchiara-patch-1 #109

Workflow file for this run

name: deploy-site
# Only run this when the main branch changes
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
release:
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'OceanGlidersCommunity/Chla_SOP'
defaults:
run:
shell: bash -l {0}
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
# Install dependencies
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements.txt
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Zip the site (so it can be handed to the preview action)
- name: Zip the site
run: |
set -x
set -e
if [ -f site.zip ]; then
rm -rf site.zip
fi
zip -r site.zip ./_build/html
- uses: actions/upload-artifact@v2
with:
name: site-zip
path: ./site.zip
# Push the site's HTML to github-pages (only if on main, previews are sent to netlify)
- name: Deploy to GitHub pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
enable_jekyll: false
build_pdf:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Install Tex
run: |
sudo apt-get install texlive-latex-recommended texlive-latex-extra \
texlive-fonts-recommended texlive-fonts-extra \
texlive-xetex latexmk
- name: Build the book as pdf #This needs to happen after the site is zipped, since this builds different html that we dont want on the website
run: |
jupyter-book build . --builder pdflatex
- uses: actions/upload-artifact@v2
with:
name: book-pdf
path: _build/latex/python.pdf