Skip to content

try cache

try cache #16

Workflow file for this run

name: Detect Changes and Cache Folder
on:
push:
branches: [ try-cache ]
jobs:
jobone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: foo/bin
key: foocache-${{ hashFiles('foo/src/**') }}
- name: Build
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
mkdir -p foo/bin
echo "Dummy file created at $(date)" > foo/bin/dummy.txt
- name: Test
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
echo "Testing..."
cat foo/bin/dummy.txt
- name: Cache
id: cache-save
uses: actions/cache/save@v4
with:
path: foo/bin
key: foocache-${{ hashFiles('foo/src/**') }}
jobtwo:
needs: jobone
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: foo/bin
key: foocache-${{ hashFiles('foo/src/**') }}
- name: Use cached bin folder
run: |
ls -la foo/bin/
cat foo/bin/dummy.txt