From b90905703dbdfe0dbffa3ac6b89c637ade495bf5 Mon Sep 17 00:00:00 2001 From: vscaiceanu-1a <86055112+vscaiceanu-1a@users.noreply.github.com> Date: Tue, 5 Nov 2024 16:41:28 +0200 Subject: [PATCH] fix(pipeline): cache yarn deps with corepack --- .../__dot__github/actions/setup/action.yml | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/@o3r/pipeline/schematics/ng-add/templates/github/__dot__github/actions/setup/action.yml b/packages/@o3r/pipeline/schematics/ng-add/templates/github/__dot__github/actions/setup/action.yml index 2f6c6e6853..15e8ad73a9 100644 --- a/packages/@o3r/pipeline/schematics/ng-add/templates/github/__dot__github/actions/setup/action.yml +++ b/packages/@o3r/pipeline/schematics/ng-add/templates/github/__dot__github/actions/setup/action.yml @@ -6,16 +6,26 @@ runs: steps: - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: - node-version: 20 - cache: <%= packageManager %> + node-version: 20<% if (packageManager === 'npm') { %> + cache: npm<% } %> - name: Enable Corepack shell: bash - run: corepack enable - - name: Install -<% if (npmRegistry) { %> + run: corepack enable<% if (packageManager === 'yarn') { %> + - name: Cache dependencies + uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + with: + path: | + .yarn/cache + .yarn/unplugged + .pnp.cjs + .pnp.loader.mjs + key: ${{ runner.os }}-deps-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-deps + ${{ runner.os }}<% } %> + - name: Install<% if (npmRegistry) { %> env: COREPACK_NPM_REGISTRY: <%= npmRegistry %> - COREPACK_INTEGRITY_KEYS: "" -<% } %> + COREPACK_INTEGRITY_KEYS: ""<% } %> shell: bash run: <%= setupCommand %>