File tree Expand file tree Collapse file tree 4 files changed +79
-24
lines changed Expand file tree Collapse file tree 4 files changed +79
-24
lines changed Original file line number Diff line number Diff line change
1
+ name : ' Configure Node.js'
2
+ description : ' Install Node.js and install Node.js modules or restore cache'
3
+
4
+ inputs :
5
+ node-version :
6
+ description : ' NodeJS Version'
7
+ default : ' 18'
8
+ lookup-only :
9
+ description : ' If true, only checks if cache entry exists and skips download. Does not change save cache behavior'
10
+ default : ' false'
11
+
12
+ runs :
13
+ using : ' composite'
14
+ steps :
15
+ - uses : actions/setup-node@v4
16
+ with :
17
+ node-version : ${{ inputs.node-version }}
18
+
19
+ - name : Restore Node Modules from Cache
20
+ id : cache-node-modules
21
+ uses : actions/cache@v4
22
+ with :
23
+ path : |
24
+ node_modules
25
+ packages/**/node_modules
26
+ !node_modules/.cache
27
+ key : node-modules-${{ inputs.node-version }}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'package-lock.json', '**/package-lock.json') }}
28
+ lookup-only : ${{ inputs.lookup-only }}
29
+
30
+ - name : Install dependencies
31
+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
32
+ shell : bash
33
+ run : npm ci
Original file line number Diff line number Diff line change 9
9
- main
10
10
11
11
jobs :
12
- build :
12
+ check-access :
13
13
runs-on : ubuntu-latest
14
+ outputs :
15
+ has-token-access : ${{ steps.check.outputs.has-token-access }}
14
16
steps :
15
- - name : Checkout code
16
- uses : actions/checkout@v3
17
+ - id : check
18
+ run : |
19
+ echo "has-token-access=$(if [[ '${{ github.event.pull_request.head.repo.fork }}' != 'true' && '${{ github.actor }}' != 'dependabot[bot]' ]]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT
17
20
18
- - name : Use Node.js 16
19
- uses : actions/setup-node@v3
21
+ install-deps :
22
+ runs-on : ubuntu-latest
23
+ steps :
24
+ - uses : actions/checkout@v4
25
+ - uses : ./.github/actions/configure-nodejs
20
26
with :
21
- node-version : 16
27
+ lookup-only : ' true' # We only want to lookup from the cache - if a hit, this job does nothing
28
+
29
+ build :
30
+ needs :
31
+ - install-deps
32
+ - check-access
33
+ runs-on : ubuntu-latest
34
+ steps :
35
+ - name : Checkout code
36
+ uses : actions/checkout@v4
22
37
23
- - name : Install Modules
24
- run : npm ci
38
+ - uses : ./.github/actions/configure-nodejs
25
39
26
40
- name : Build
27
41
run : npm run build
Original file line number Diff line number Diff line change 7
7
workflow_dispatch :
8
8
9
9
jobs :
10
+ install-deps :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - uses : actions/checkout@v4
14
+ - uses : ./.github/actions/configure-nodejs
15
+ with :
16
+ lookup-only : ' true' # We only want to lookup from the cache - if a hit, this job does nothing
17
+
10
18
build :
19
+ needs :
20
+ - install-deps
11
21
runs-on : ubuntu-latest
12
22
steps :
13
23
- name : Checkout code
14
- uses : actions/checkout@v3
15
-
16
- - name : Use Node.js 16
17
- uses : actions/setup-node@v3
18
- with :
19
- node-version : 16
24
+ uses : actions/checkout@v4
20
25
21
- - name : Install Modules
22
- run : npm ci
26
+ - uses : ./.github/actions/configure-nodejs
23
27
24
28
- name : Build Docs
25
29
run : npm run build:docs
Original file line number Diff line number Diff line change 5
5
types : [published]
6
6
7
7
jobs :
8
+ install-deps :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - uses : actions/checkout@v4
12
+ - uses : ./.github/actions/configure-nodejs
13
+ with :
14
+ lookup-only : ' true' # We only want to lookup from the cache - if a hit, this job does nothing
15
+
8
16
build :
17
+ needs :
18
+ - install-deps
9
19
runs-on : ubuntu-latest
10
20
steps :
11
21
- name : Checkout code
12
- uses : actions/checkout@v3
22
+ uses : actions/checkout@v4
13
23
14
- - name : Use Node.js 16
15
- uses : actions/setup-node@v3
16
- with :
17
- node-version : 16
24
+ - uses : ./.github/actions/configure-nodejs
18
25
19
26
- name : Use the Release Tag Version
20
27
run : |
21
28
npm version from-git --allow-same-version --no-git-tag-version
22
29
23
- - name : Install Modules
24
- run : npm ci
25
-
26
30
- name : Build
27
31
run : npm run build
28
32
You can’t perform that action at this time.
0 commit comments