From 09eda1248d1452c980ef15198cfbb2bcd8fc84ff Mon Sep 17 00:00:00 2001 From: Chukwuma Nwaugha Date: Tue, 12 Nov 2024 16:30:34 +0000 Subject: [PATCH] add node_pnpm_cache --- .github/actions/node_pnpm_cache/action.yml | 32 ++++++++++++++++++++++ .github/workflows/deploy_app.yml | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/actions/node_pnpm_cache/action.yml diff --git a/.github/actions/node_pnpm_cache/action.yml b/.github/actions/node_pnpm_cache/action.yml new file mode 100644 index 0000000..a15a7c6 --- /dev/null +++ b/.github/actions/node_pnpm_cache/action.yml @@ -0,0 +1,32 @@ +name: node_pnpm_cache +description: Composite action to setup Node with pnpm and cache node_modules + +inputs: + cache-paths: + description: paths to cache + required: false + cache-key: + description: cache key + required: true + +outputs: + cache-hit: + description: forward the actions/cache cache-hit output + value: ${{ steps.node-cache.outputs.cache-hit }} + +runs: + using: composite + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/cache@v4 + with: + path: | + ~/.local/share/pnpm/store + **/node_modules + ${{ inputs.cache-paths }} + key: ${{ inputs.cache-key }} + - uses: pnpm/action-setup@v3 + with: + version: 8 diff --git a/.github/workflows/deploy_app.yml b/.github/workflows/deploy_app.yml index 3f34e9c..99a047e 100644 --- a/.github/workflows/deploy_app.yml +++ b/.github/workflows/deploy_app.yml @@ -50,7 +50,7 @@ jobs: steps: - uses: actions/checkout@v4 - id: cache-app - uses: ./.github/actions/setup-node-pnpm-cache + uses: ./.github/actions/node_pnpm_cache with: cache-key: app-${{ hashFiles('**/pnpm-lock.yaml') }} cache-paths: |