try cache #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
uses: actions/cache@v4 | |
with: | |
path: foo/bin | |
key: foo-${{ hashFiles('foo/src/**') }} | |
- name: Write dummy file and save cache if needed | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p foo/bin | |
echo "Dummy file created at $(date)" > foo/bin/dummy.txt | |
echo "Cache updated" | |
jobtwo: | |
needs: jobone | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Restore cached Primes | |
uses: actions/cache/restore@v4 | |
with: | |
path: foo/bin | |
key: foo-${{ hashFiles('foo/src/**') }} | |
- name: Use cached bin folder | |
run: | | |
ls -la foo/bin/ | |
cat foo/bin/dummy.txt | |