Skip to content

Commit

Permalink
chore: add build cache to packages workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
byCedric committed Sep 19, 2023
1 parent ee5bbc5 commit 1f6ced5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/actions/setup-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Setup Cache
description: Prepare Snack's build cache in GitHub Actions

runs:
using: composite
steps:
- name: ♻️ Find modules cache
id: modules-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
shell: bash

- name: ♻️ Restore modules cache
uses: actions/cache@v3
with:
path: ${{ steps.modules-cache.outputs.dir }}
key: yarn-TEST_1-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-TEST_1-${{ runner.os }}-
- name: ♻️ Restore build cache
uses: actions/cache@v3
with:
key: turbo-TEST_3-${{ runner.os }}-${{ github.sha }}
restore-keys: |
turbo-TEST_3-${{ runner.os }}-
path: |
node_modules/.cache/turbo
packages/*/.turbo
6 changes: 5 additions & 1 deletion .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
workflow_dispatch:
pull_request:
paths:
- .github/actions/setup-cache/**
- .github/workflows/packages.yml
- packages/**
- .eslint*
Expand All @@ -17,6 +18,7 @@ on:
push:
branches: [main]
paths:
- .github/actions/setup-cache/**
- .github/workflows/packages.yml
- packages/**
- .eslint*
Expand Down Expand Up @@ -54,7 +56,9 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: 🏗 Setup cache
uses: ./.github/actions/setup-cache

- name: 📦 Install monorepo dependencies
run: yarn install --frozen-lockfile
Expand Down

0 comments on commit 1f6ced5

Please sign in to comment.