-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from ThomasAribart/cache-node-dependencies-in-ci
chore: cache node dependencies in CI
- Loading branch information
Showing
2 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Install Node Dependencies | ||
description: Install dependencies using yarn | ||
inputs: | ||
node-version: | ||
required: true | ||
typescript-version: | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
shell: bash | ||
|
||
- name: Sync yarn cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Sync node_modules cache | ||
id: sync-node-modules-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ inputs.node-version }}-${{ inputs.typescript-version }}-${{ hashFiles('./yarn.lock') }} | ||
|
||
- name: Install node_modules | ||
run: if [ '${{ steps.sync-node-modules-cache.outputs.cache-hit }}' != 'true' ]; then yarn install --immutable; fi | ||
shell: bash | ||
|
||
- name: Override TS with correct version | ||
run: if [ '${{ steps.sync-node-modules-cache.outputs.cache-hit }}' != 'true' ]; then yarn add --dev typescript@${{ inputs.typescript-version }}; fi | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters