CI: cache LFS content

This commit is contained in:
Xiretza 2025-02-19 19:43:53 +00:00
parent c91bcabec6
commit 80e9f4f593

View file

@ -9,11 +9,24 @@ jobs:
env:
HUGO_CACHEDIR: /tmp/hugo_cache
steps:
- name: Checkout
# LFS caching courtesy of https://github.com/actions/checkout/issues/165#issuecomment-657673315
- name: Checkout without LFS
uses: actions/checkout@v4
with:
submodules: recursive
lfs: 'true'
lfs: 'false'
- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- name: Restore LFS cache
uses: actions/cache@v4
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
restore-keys: ${{ runner.os }}-lfs-
- name: Git LFS Pull
run: git lfs pull
# Hugo caching
- name: Get current date (for cache eviction)
id: get-date
run: echo "year-month-day=$(date --utc +'%Y%m%d')" >> $GITHUB_OUTPUT
@ -21,9 +34,9 @@ jobs:
uses: actions/cache@v4
with:
# Caches are immutable, create a new cache every day so it's always somewhat fresh.
key: ${{ runner.os }}-${{ steps.get-date.outputs.year-month-day }}
key: ${{ runner.os }}-hugo-${{ steps.get-date.outputs.year-month-day }}
# If no cache has been created yet today, restore a previous one.
restore-keys: ${{ runner.os }}-
restore-keys: ${{ runner.os }}-hugo-
path: |
resources/_gen/
${{ env.HUGO_CACHEDIR }}