Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/node-module-cache-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
update_cache:
runs-on: ${{ inputs.cpu_architecture == 'x86_64' && 'ubuntu-latest' || format('ubuntu-latest-{0}', inputs.cpu_architecture) }}
steps:
- name: Deprecated warning
run: echo "::warning::⚠️ deprecated workflow, use node-module-cache-v2.yml instead"

- uses: actions/checkout@v4

- name: Use Node.js version from package.json
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/node-module-cache-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Update node_modules cache

on:
workflow_call:
inputs:
use_legacy_peer_deps:
type: boolean
default: false
description: Enable --legacy-peer-deps option
use_ignore_scripts:
type: boolean
default: false
description: Enable --ignore-scripts option
cpu_architectures:
type: string
description: Array of architectures to run on (e.g., '["x86_64", "arm64"]')

jobs:
update_cache:
strategy:
matrix:
cpu_architecture: ${{ fromJSON(inputs.cpu_architectures) }}

runs-on: ${{ matrix.cpu_architecture == 'x86_64' && 'ubuntu-latest' || 'ubuntu-latest-arm64' }}

steps:
- uses: actions/checkout@v4

- name: Use Node.js version from package.json
uses: actions/setup-node@v4
with:
node-version-file: "package.json"

- name: Set authToken for npm
run: |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}

- name: Npm install
run: npm ci ${{ inputs.use_legacy_peer_deps && '--legacy-peer-deps' || ''}} ${{ inputs.use_ignore_scripts && '--ignore-scripts' || ''}}

- name: Save cache
uses: actions/cache/save@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ runner.arch }}-npm-${{ hashFiles('package-lock.json') }}