From 3c0fb4389ed0348b50046be85d20f6963620b4fc Mon Sep 17 00:00:00 2001 From: Severin Date: Tue, 2 Apr 2024 19:57:10 +0200 Subject: [PATCH] Cache book builds --- .github/workflows/deploy-book-ghpages.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-book-ghpages.yml b/.github/workflows/deploy-book-ghpages.yml index 8f35af3..9661c83 100644 --- a/.github/workflows/deploy-book-ghpages.yml +++ b/.github/workflows/deploy-book-ghpages.yml @@ -50,17 +50,27 @@ jobs: with: ref: ${{ matrix.branch }} - # Install dependencies - - name: Set up Python 3.11 + - name: Cache page build + id: cache-html + uses: actions/cache@v4 + with: + path: "book/_build/html" + key: html-build-${{ hashFiles('book/**', 'figures/**', 'requirements.txt') }} + + - if: ${{ steps.cache-html.outputs.cache-hit != 'true' }} + name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: 3.11 + cache: 'pip' - - name: Install dependencies + - if: ${{ steps.cache-html.outputs.cache-hit != 'true' }} + name: Install dependencies run: | pip install -r requirements.txt - - name: Build the book from branch + - if: ${{ steps.cache-html.outputs.cache-hit != 'true' }} + name: Preprocess & build the book from branch run: | jupyter-book build book/