Skip to content

Adding cache to conda install #10

Adding cache to conda install

Adding cache to conda install #10

Workflow file for this run

name: build-deploy-book
# Only run this when the master branch changes
on:
workflow_dispatch:
push:
branches:
- jupyterbook
permissions:
contents: read
pages: write
id-token: write
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v4
# Install dependencies
# Install Mambaforge
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: jupyterbook-atlas
- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key:
conda-${{ runner.os }}-
${{ runner.arch }}-
${{ steps.get-date.outputs.today }}-
${{ hashFiles('binder/conda/environment.yml') }}-
${{ env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
id: cache
- name: Update environment
run:
mamba env update -n jupyterbook-atlas -f
binder/conda/environment.yml
if: steps.cache.outputs.cache-hit != 'true'
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Upload the book's HTML as an artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "_build/html"
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
# Deploy the book's HTML to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4