DRY
parent
ea6114835d
commit
4bfd63afef
|
@ -0,0 +1,26 @@
|
|||
name: Yarn install
|
||||
description: "Install all NPM dependencies, caches them and restores if necessary"
|
||||
inputs:
|
||||
node_version:
|
||||
required: true
|
||||
description: "The node_version used to run this"
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ inputs.node_version }}
|
||||
- name: node_modules cache
|
||||
id: node-modules-cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: node-modules-yarn
|
||||
cache-key: ${{ inputs.node_version }}-${{ hashFiles('yarn.lock') }}
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }}
|
||||
restore-keys: ${{ runner.os }}-${{ env.cache-name }}-
|
||||
- name: Yarn install
|
||||
if: steps.node-modules-cache.outputs.cache-hit != 'true'
|
||||
run: yarn install --prefer-offline --frozen-lockfile
|
|
@ -50,10 +50,9 @@ jobs:
|
|||
# change this if your nextjs app does not live at the root of the repo
|
||||
working-directory: ./apps/web/
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: ./.github/actions/yarn-install
|
||||
with:
|
||||
node-version: ${{ env.node_version }}
|
||||
node_version: ${{ env.node_version }}
|
||||
- name: Restore node_modules from cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
|
|
|
@ -14,21 +14,6 @@ jobs:
|
|||
group: yarn-install-${{ github.sha }}
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: ./.github/actions/yarn-install
|
||||
with:
|
||||
node-version: ${{ secrets.NODE_VERSION }}
|
||||
# node_module cache helps to avoid 1 minute copying from yarn cache on every job run
|
||||
- name: node_modules cache
|
||||
id: node-modules-cache
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: node-modules-yarn
|
||||
cache-key: ${{ secrets.NODE_VERSION }}-${{ hashFiles('yarn.lock') }}
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-key }}
|
||||
restore-keys: ${{ runner.os }}-${{ env.cache-name }}-
|
||||
- name: Yarn install
|
||||
if: steps.node-modules-cache.outputs.cache-hit != 'true'
|
||||
run: yarn install --prefer-offline --frozen-lockfile
|
||||
node_version: ${{ secrets.node_version }}
|
||||
|
|
Loading…
Reference in New Issue