26
26
GATSBY_NEWSLETTER_FORM_ID : 1420
27
27
28
28
jobs :
29
- update-dependencies :
30
- name : Update node module dependencies
31
- runs-on : ubuntu-latest
32
- steps :
33
- - name : Checkout project
34
- uses : actions/checkout@v2
35
- - name : Use Node.js 16.xs
36
- uses : actions/setup-node@v2
37
- with :
38
- node-version : ' 16.x'
39
- registry-url : ' https://registry.npmjs.org'
40
- - name : Restore cache
41
- uses : actions/cache@v2
42
- with :
43
- path : ' **/node_modules'
44
- key : ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
45
- - name : Install dependencies
46
- run : npm install
47
29
lint :
48
30
name : Lint code
49
31
runs-on : ubuntu-latest
50
- needs :
51
- - update-dependencies
52
32
steps :
53
33
- name : Checkout project
54
34
uses : actions/checkout@v2
@@ -57,13 +37,28 @@ jobs:
57
37
with :
58
38
node-version : ' 16.x'
59
39
registry-url : ' https://registry.npmjs.org'
60
- - name : Restore cache
40
+ cache : ' npm'
41
+ - name : Restore node_modules cache
61
42
uses : actions/cache@v2
62
43
with :
63
44
path : ' **/node_modules'
64
45
key : ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
65
- - name : Install dependencies
46
+ - name : Install
66
47
run : npm install
48
+ - name : Restore Gatsby cache
49
+ uses : actions/cache@v3
50
+ with :
51
+ # Gatsby requires both .cache and public. It will refuse to use .cache/ if public/ is not present.
52
+ path : |
53
+ .cache
54
+ public
55
+ # Cache will not be used by Gatsby if the following files change:
56
+ # https://www.gatsbyjs.com/docs/build-caching/
57
+ # We use the commit SHA on the key to prevent an ever-living cache entry keyed as "main".
58
+ key : pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-${{ github.ref }}-${{ github.sha }}
59
+ restore-keys : |
60
+ pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-${{ github.ref }}-
61
+ pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-
67
62
- name : Check formatting
68
63
run : |
69
64
npm run format
@@ -99,13 +94,26 @@ jobs:
99
94
with :
100
95
node-version : ' 16.x'
101
96
registry-url : ' https://registry.npmjs.org'
102
- - name : Restore cache
97
+ cache : ' npm'
98
+ - name : Restore node_modules cache
103
99
uses : actions/cache@v2
104
100
with :
105
101
path : ' **/node_modules'
106
102
key : ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
107
- - name : Install dependencies
103
+ - name : Install
108
104
run : npm install
105
+ - name : Restore Gatsby cache
106
+ uses : actions/cache@v3
107
+ with :
108
+ # Gatsby requires both .cache and public. It will refuse to use .cache/ if public/ is not present.
109
+ path : |
110
+ .cache
111
+ public
112
+ # Cache will not be used by Gatsby if the following files change:
113
+ # https://www.gatsbyjs.com/docs/build-caching/
114
+ key : pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-${{ github.ref }}
115
+ restore-keys : |
116
+ pr-gatsby-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-
109
117
- name : Build project
110
118
run : npm run build:gatsby
111
119
- name : Checks if AWS CLI already installed
0 commit comments