Skip to content

Commit

Permalink
chore: node modules caching setting
Browse files Browse the repository at this point in the history
  • Loading branch information
wuzoo committed Dec 3, 2024
1 parent 3d240cd commit 3831dd9
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:
name: Storybook Chromatic Deployment
runs-on: ubuntu-latest
steps:
- name: measure time
run: 'echo "::set-output name=START_TIME::$(date +%s)"'

- uses: actions/checkout@v1
- name: Install pnpm
uses: pnpm/action-setup@v4
Expand All @@ -22,23 +19,36 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 21

- name: Cache node modules
id: cache-node
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.OS }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install dependencies
if: steps.cache-node.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile

- name: Build tiki ui
id: cache-tiki-ui
uses: actions/cache@v4
with:
path: packages/ui/dist
key: ${{runner.os}}-tiki-ui-${{hashFiles('packages/ui/package.json', 'packages/ui/src/**')}}
restore-key: ${{runner.os}}-tiki-ui-
key: ${{runner.os}}-ui-${{hashFiles('packages/ui/package.json', 'packages/ui/src/**')}}
restore-keys: ${{runner.os}}-ui-

- name: Build tiki icon
id: cache-tiki-icon
uses: actions/cache@v4
with:
path: packages/icon/dist
key: ${{runner.os}}-tiki-icon-${{hashFiles('packages/icon/package.json', 'packages/icon/src/**')}}
restore-key: ${{runner.os}}-tiki-icon
key: ${{runner.os}}-icon-${{hashFiles('packages/icon/package.json', 'packages/icon/src/**')}}
restore-keys: ${{runner.os}}-icon-

- name: Check ui cache hit
if: steps.cache-tiki-ui.outputs.cache-hit != 'true'
Expand All @@ -55,9 +65,6 @@ jobs:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: measure time
run: 'Total Build Time: $((END_TIME - $START_TIME)) seconds'

- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
env:
Expand Down

0 comments on commit 3831dd9

Please sign in to comment.