-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (33 loc) · 1.18 KB
/
install-dependencies.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Define shared variables to be reused by callable workflow
on:
workflow_call:
jobs:
install-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout Base
- name: Restore variables
uses: actions/cache/restore@v3
with:
path: 'temp/variables.json'
key: shared-variables-${{ github.run_id }}-${{ github.run_attempt }}
- name: Set env variables
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const sharedVariables = JSON.parse(fs.readFileSync('temp/variables.json', { encoding: 'utf8' }))
Object.entries(sharedVariables).forEach(([name, value]) => {
core.exportVariable(name, value);
});
- name: Cache or restore node_modules
id: cache-nodemodules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ env.DEPENDENCIES_CACHE_KEY }}
restore-keys: ${{ env.DEPENDENCIES_RESTORE_KEY }}
- name: Install dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm ci --legacy-peer-deps