Skip to content

Commit

Permalink
Adding cache to conda install
Browse files Browse the repository at this point in the history
  • Loading branch information
cofinoa committed Apr 20, 2024
1 parent a20a9f2 commit aeb1268
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,41 @@ jobs:

# Install dependencies
# Install Mambaforge

- name: Setup Jupyterbook
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
environment-file: binder/conda/environment.yml
mamba-version: "*"

# Build the book
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 .
Expand Down

0 comments on commit aeb1268

Please sign in to comment.