mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-20 01:13:56 +08:00
actions/cache@v3 uses the deprecated Node.js 16 so update to use v4 which uses Node.js 20. This also applies to save and restore
50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: 'automatically cache based on current runner'
|
|
|
|
inputs:
|
|
path:
|
|
description: 'path to cache'
|
|
required: true
|
|
key:
|
|
description: 'key'
|
|
required: true
|
|
restore-keys:
|
|
description: 'restore-keys'
|
|
required: true
|
|
save:
|
|
description: 'whether to save the cache'
|
|
default: 'false'
|
|
required: false
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: setup namespace cache
|
|
if: ${{ contains(runner.name, 'nsc') }}
|
|
uses: namespacelabs/nscloud-cache-action@v1
|
|
with:
|
|
path: ${{ inputs.path }}
|
|
|
|
- name: setup github cache
|
|
if: ${{ !contains(runner.name, 'nsc') && inputs.save != 'false' }}
|
|
uses: 'actions/cache@v4'
|
|
with:
|
|
path: ${{ inputs.path }}
|
|
key: ${{ inputs.key }}
|
|
restore-keys: ${{ inputs.restore-keys }}
|
|
|
|
- name: setup github cache
|
|
if: ${{ !contains(runner.name, 'nsc') && inputs.save == 'false' }}
|
|
uses: 'actions/cache/restore@v4'
|
|
with:
|
|
path: ${{ inputs.path }}
|
|
key: ${{ inputs.key }}
|
|
restore-keys: ${{ inputs.restore-keys }}
|
|
|
|
# make the directory manually in case we didn't get a hit, so it doesn't fail on future steps
|
|
- id: scons-cache-setup
|
|
shell: bash
|
|
run: |
|
|
mkdir -p ${{ inputs.path }}
|
|
sudo chmod -R 777 ${{ inputs.path }}
|
|
sudo chown -R $USER ${{ inputs.path }}
|