Skip to content

Rebuild Cache (Next) #184

Rebuild Cache (Next)

Rebuild Cache (Next) #184

Workflow file for this run

# This ensures build/yarn caches are rebuilt and that we don't experience cache miss
# when pushing our own code (which makes the whole job last significantly longer).
name: Rebuild Cache (Next)
on:
schedule:
- cron: "0 1 * * *" # Every day at 1AM.
env:
NODE_OPTIONS: --max_old_space_size=4096
jobs:
cache-keys:
name: Create cache keys
runs-on: ubuntu-latest
outputs:
day: ${{ steps.create-cache-keys.outputs.day }}
steps:
- name: Create cache key (day)
id: create-cache-keys
run: echo "day=$(node --eval "console.log(new Date().getDate())")" >> $GITHUB_OUTPUT
cache-dependencies-packages-root:
name: Cache dependencies and packages
runs-on: ubuntu-latest
needs: cache-keys
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: yarn-cache
with:
path: .yarn/cache
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- uses: actions/cache@v3
id: cached-packages
with:
path: .webiny/cached-packages
key: ${{ runner.os }}-${{ needs.cache-keys.outputs.day }}-${{ secrets.RANDOM_CACHE_KEY_SUFFIX }}
- name: Install dependencies
run: yarn --immutable
- name: Build packages
run: yarn build
cache-dependencies-packages-next:
name: Cache dependencies and packages ("next" folder)
runs-on: ubuntu-latest
needs: cache-keys
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/checkout@v3
with:
path: next
- uses: actions/cache@v3
id: yarn-cache
with:
path: next/.yarn/cache
key: yarn-${{ runner.os }}-${{ hashFiles('next/**/yarn.lock') }}
- uses: actions/cache@v3
id: cached-packages
with:
path: next/.webiny/cached-packages
key: ${{ runner.os }}-${{ needs.cache-keys.outputs.day }}-${{ secrets.RANDOM_CACHE_KEY_SUFFIX }}
- name: Install dependencies
working-directory: next
run: yarn --immutable
- name: Build packages
working-directory: next
run: yarn build