Merge pull request #38 from m2lines/pre-commit-ci-update-config #13
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: publish-book | |
# Trigger the workflow on push to main branch | |
on: | |
push: | |
branches: | |
- main | |
# This job installs dependencies, builds the book, and deploys the html | |
jobs: | |
build-and-deploy-book: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.9] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get PR number | |
run: echo "Your PR is ${PR}" | |
env: | |
PR: ${{ github.event.pull_request.number }} | |
- name: π¦ Cache Conda Packages | |
uses: actions/cache@v2 | |
env: | |
# Increase this value to reset cache if etc/example-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('conda-linux-64.lock') }} | |
- name: π Set up Conda environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: false | |
activate-environment: DGM2lines | |
environment-file: conda-linux-64.lock | |
- name: π Check Conda environment | |
shell: bash -l {0} | |
run: | | |
pip install -r requirements.txt | |
conda info | |
conda list | |
- name: π¦ Cache Notebooks | |
uses: actions/cache@v2 | |
with: | |
path: src/_build/.jupyter_cache | |
key: notebook_cache-${{hashFiles('_toc.yml', '_config.yml', 'environment.yml') }} | |
- name: π Build the book | |
shell: bash -l {0} | |
run: | | |
cd src | |
mkdir -p _notebook_cache | |
jupyter-book build . | |
- name: π Show logs from the book build | |
shell: bash -l {0} | |
run: | | |
find src/_build/html -name "*.log" -print -exec cat {} \; | |
- name: π Deploy to GitHub Pages | |
# redudant but keeping for testing purposes | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: src/_build/html | |
keep_files: false | |
force_orphan: true |