Improve caching

This commit is contained in:
Felipe Knorr Kuhn 2026-02-15 14:50:31 -08:00
parent 70d2c9a97b
commit 7a4bbd8b6d
No known key found for this signature in database
GPG Key ID: 79619B52BB097C1A
2 changed files with 22 additions and 6 deletions

View File

@ -9,6 +9,10 @@ inputs:
description: 'Whether to download from artifacts (requires cache job to have run first)'
required: false
default: 'true'
cache-version:
description: 'Cache version (must match sync-assets for cache hits)'
required: false
default: 'v1'
outputs:
mining-pool-cache-hit:
@ -27,7 +31,9 @@ runs:
uses: actions/cache/restore@v4
with:
path: mining-pool-assets.zip
key: mining-pool-assets-cache
key: mining-pool-assets-${{ inputs.cache-version }}-${{ hashFiles(format('{0}/package.json', inputs.frontend-path), format('{0}/package-lock.json', inputs.frontend-path)) }}
restore-keys: |
mining-pool-assets-${{ inputs.cache-version }}-
- name: Restore cached promo video assets
continue-on-error: true
@ -35,7 +41,9 @@ runs:
uses: actions/cache/restore@v4
with:
path: promo-video-assets.zip
key: promo-video-assets-cache
key: promo-video-assets-${{ inputs.cache-version }}-${{ hashFiles(format('{0}/package.json', inputs.frontend-path), format('{0}/package-lock.json', inputs.frontend-path)) }}
restore-keys: |
promo-video-assets-${{ inputs.cache-version }}-
- name: Download mining pool artifact
if: inputs.use-artifacts == 'true'

View File

@ -12,6 +12,10 @@ inputs:
description: 'npm command to run for syncing assets'
required: false
default: 'npm run sync-assets-dev'
cache-version:
description: 'Cache version for manual invalidation (bump to force fresh sync)'
required: false
default: 'v1'
runs:
using: 'composite'
@ -22,7 +26,9 @@ runs:
uses: actions/cache/restore@v4
with:
path: mining-pool-assets.zip
key: mining-pool-assets-cache
key: mining-pool-assets-${{ inputs.cache-version }}-${{ hashFiles(format('{0}/package.json', inputs.frontend-path), format('{0}/package-lock.json', inputs.frontend-path)) }}
restore-keys: |
mining-pool-assets-${{ inputs.cache-version }}-
- name: Restore cached promo video assets
continue-on-error: true
@ -30,7 +36,9 @@ runs:
uses: actions/cache/restore@v4
with:
path: promo-video-assets.zip
key: promo-video-assets-cache
key: promo-video-assets-${{ inputs.cache-version }}-${{ hashFiles(format('{0}/package.json', inputs.frontend-path), format('{0}/package-lock.json', inputs.frontend-path)) }}
restore-keys: |
promo-video-assets-${{ inputs.cache-version }}-
- name: Unzip mining pool assets before sync
continue-on-error: true
@ -86,11 +94,11 @@ runs:
uses: actions/cache/save@v4
with:
path: mining-pool-assets.zip
key: mining-pool-assets-cache
key: mining-pool-assets-${{ inputs.cache-version }}-${{ hashFiles(format('{0}/package.json', inputs.frontend-path), format('{0}/package-lock.json', inputs.frontend-path)) }}
- name: Save promo video assets cache
if: steps.cache-promo-video-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: promo-video-assets.zip
key: promo-video-assets-cache
key: promo-video-assets-${{ inputs.cache-version }}-${{ hashFiles(format('{0}/package.json', inputs.frontend-path), format('{0}/package-lock.json', inputs.frontend-path)) }}