cache just the .js files, to avoid stale translations

This commit is contained in:
Samuel Newman
2025-11-19 15:16:15 +02:00
parent 3eac554633
commit 3f8c090577
@@ -8,17 +8,19 @@ inputs:
runs:
using: 'composite'
steps:
- name: 📝 Extract English source strings
- name: 📝 Extract all translation strings
shell: bash
run: yarn intl:extract
run: yarn intl:extract:all
- name: 🔑 Generate cache key
id: cache-key
shell: bash
run: |
EN_HASH=$(cat src/locale/locales/en/messages.po | shasum -a 256 | cut -d' ' -f1)
YARN_HASH=$(cat yarn.lock | shasum -a 256 | cut -d' ' -f1)
CACHE_KEY="translations-${EN_HASH}-${YARN_HASH}"
# Hash all .po files to detect any translation changes
PO_HASH=$(find src/locale/locales -name "messages.po" -type f -exec cat {} \; | shasum -a 256 | cut -d' ' -f1)
# Get @lingui/cli version to bust cache on compiler upgrades
LINGUI_VERSION=$(grep '"version"' node_modules/@lingui/cli/package.json | head -1 | sed 's/.*"version": "\(.*\)".*/\1/')
CACHE_KEY="translations-${PO_HASH}-lingui-${LINGUI_VERSION}"
echo "key=${CACHE_KEY}" >> $GITHUB_OUTPUT
echo "Cache key: ${CACHE_KEY}"
@@ -26,9 +28,7 @@ runs:
id: cache-translations
uses: actions/cache@v4
with:
path: |
src/locale/locales/*/messages.po
src/locale/locales/*/messages.js
path: src/locale/locales/*/messages.js
key: ${{ steps.cache-key.outputs.key }}
- name: 🔤 Compile translations