From de0cc0d94f883941bff0ae4356396a6eb49728f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Wed, 5 Feb 2025 13:04:42 +0800 Subject: [PATCH] ci: Try to implement caching to sub-parts of site --- .github/workflows/build_deploy.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/build_deploy.yml b/.github/workflows/build_deploy.yml index 518b322..2461c8b 100644 --- a/.github/workflows/build_deploy.yml +++ b/.github/workflows/build_deploy.yml @@ -39,11 +39,23 @@ jobs: with: submodules: 'recursive' depth: 1 + - name: Calculate cache key + id: cache-key + run: | + echo "::set-output name=cache-key::$(scripts/metacacher metanorma metanorma-admin.yml)" + - name: Restore cache + id: cache + uses: actions/cache@v4 + with: + path: _site/administrative + key: ${{ steps.cache-key.outputs.cache-key }} - name: Use Ruby + if: steps.cache.outputs.cache-hit != 'true' uses: ruby/setup-ruby@v1 with: bundler-cache: true - name: Build site + if: steps.cache.outputs.cache-hit != 'true' run: | make build-admin - name: Save artifacts @@ -61,11 +73,23 @@ jobs: with: submodules: 'recursive' depth: 1 + - name: Calculate cache key + id: cache-key + run: | + echo "::set-output name=cache-key::$(scripts/metacacher metanorma metanorma-standards.yml)" + - name: Restore cache + id: cache + uses: actions/cache@v4 + with: + path: _site/standards + key: ${{ steps.cache-key.outputs.cache-key }} - name: Use Ruby + if: steps.cache.outputs.cache-hit != 'true' uses: ruby/setup-ruby@v1 with: bundler-cache: true - name: Build site + if: steps.cache.outputs.cache-hit != 'true' run: | make build-standards - name: Save artifacts @@ -82,13 +106,25 @@ jobs: with: submodules: 'recursive' depth: 1 + - name: Calculate cache key + id: cache-key + run: | + echo "::set-output name=cache-key::$(scripts/metacacher jekyll _config.yml)" + - name: Restore cache + id: cache + uses: actions/cache@v4 + with: + path: _site + key: ${{ steps.cache-key.outputs.cache-key }} - name: Use Ruby + if: steps.cache.outputs.cache-hit != 'true' uses: ruby/setup-ruby@v1 with: bundler-cache: true env: JEKYLL: 1 - name: Build site + if: steps.cache.outputs.cache-hit != 'true' run: | make _site - name: Save artifacts