44 lines
1.6 KiB
YAML
44 lines
1.6 KiB
YAML
name: Warmup getRemoteJSON's cache
|
|
|
|
description: Run the script that prepares the disk-cache for getRemoteJSON
|
|
|
|
inputs:
|
|
restore-only:
|
|
description: Only attempt to restore, don't warm up
|
|
required: false
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
# The caching technique here is to unboundedly add and add to the cache.
|
|
# You "wrap" the step that appends to disk and it will possibly retrieve
|
|
# some from the cache, then save it when it's got more in it.
|
|
- name: Cache .remotejson-cache (restore)
|
|
# You can't use a SHA on these. Only possible with `actions/cache@SHA...`
|
|
uses: actions/cache/restore@v3
|
|
with:
|
|
path: .remotejson-cache
|
|
key: remotejson-cache-
|
|
restore-keys: remotejson-cache-
|
|
|
|
# When we use this composite action from the workflows like
|
|
# Azure Preview Deploy and Azure Production Deploy, we don't have
|
|
# any Node installed or any of its packages. I.e. we never
|
|
# run `npm ci` in those actions. For security sake.
|
|
# So we can't do things that require Node code.
|
|
# Tests and others will omit the `restore-only` input, but
|
|
# prepping for Docker build and push, will set it to a non-empty
|
|
# string which basically means "If you can restore it, great.
|
|
# If not, that's fine, don't bother".
|
|
- name: Run script
|
|
if: ${{ inputs.restore-only == '' }}
|
|
shell: bash
|
|
run: node script/warmup-remotejson.js
|
|
|
|
- name: Cache .remotejson-cache (save)
|
|
if: ${{ inputs.restore-only == '' }}
|
|
uses: actions/cache/save@v3
|
|
with:
|
|
path: .remotejson-cache
|
|
key: remotejson-cache-${{ github.sha }}
|