diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 232b48e8..37f49f56 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -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 .