Skip to content

update npm cache

update npm cache #11

Workflow file for this run

name: Node.js CI
on:
push:
branches:
- main # You can specify the branch you want to trigger the workflow on
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Test
run: pnpm test
- name: Build
run: pnpm build
# - name: Get npm cache directory
# id: npm-cache-dir
# shell: bash
# run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
# - uses: actions/[email protected]
# id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
# with:
# path: ${{ steps.npm-cache-dir.outputs.dir }}
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-
# - name: Install dependencies
# run: npm ci
# - name: Test
# run: npm run test
# - name: Build
# run: npm run build