@@ -3,18 +3,47 @@ name: CI
33on : push
44
55env :
6+ NODE_VERSION : ' 20.x'
67 FOLDER_PATH_STORYBOOK_BUILD : ./build-storybook-static
78
89jobs :
9- validate :
10+ build :
11+ name : Build 🏗️
1012 runs-on : ubuntu-latest
1113
1214 steps :
1315 - name : Checkout 🛎️
1416 uses : actions/checkout@v4
17+
18+ - uses : actions/setup-node@v4
19+ with :
20+ node-version : ${{ env.NODE_VERSION }}
21+
22+ - name : Cache dependencies ⚡
23+ id : cache_dependencies
24+ uses : actions/cache@v4
25+ with :
26+ path : node_modules
27+ key : node-modules-${{ hashFiles('package-lock.json') }}
28+
29+ - name : Install dependencies 🔧
30+ if : steps.cache_dependencies.outputs.cache-hit != 'true'
31+ run : npm ci
32+
33+ - name : Build 🏗️
34+ run : npm run build
35+
36+ lint :
37+ name : Lint ✅
38+ runs-on : ubuntu-latest
39+
40+ steps :
41+ - name : Checkout 🛎️
42+ uses : actions/checkout@v4
43+
1544 - uses : actions/setup-node@v4
1645 with :
17- node-version : ' 20.x '
46+ node-version : ${{ env.NODE_VERSION }}
1847
1948 - name : Cache dependencies ⚡
2049 id : cache_dependencies
@@ -30,20 +59,44 @@ jobs:
3059 - name : Lint ✅
3160 run : npm run lint
3261
33- - name : Build 🏗️
34- run : npm run build
62+ tsc :
63+ name : TypeScript Compiler 🔎
64+ runs-on : ubuntu-latest
65+
66+ steps :
67+ - name : Checkout 🛎️
68+ uses : actions/checkout@v4
69+
70+ - uses : actions/setup-node@v4
71+ with :
72+ node-version : ${{ env.NODE_VERSION }}
73+
74+ - name : Cache dependencies ⚡
75+ id : cache_dependencies
76+ uses : actions/cache@v4
77+ with :
78+ path : node_modules
79+ key : node-modules-${{ hashFiles('package-lock.json') }}
80+
81+ - name : Install dependencies 🔧
82+ if : steps.cache_dependencies.outputs.cache-hit != 'true'
83+ run : npm ci
84+
85+ - name : TypeScript Compiler 🔎
86+ run : npm run tsc
3587
3688 storybook :
3789 runs-on : ubuntu-latest
38- needs : [validate ]
90+ needs : [build, lint, tsc ]
3991 if : github.ref == 'refs/heads/main'
4092
4193 steps :
4294 - name : Checkout 🛎️
4395 uses : actions/checkout@v4
96+
4497 - uses : actions/setup-node@v4
4598 with :
46- node-version : ' 20.x '
99+ node-version : ${{ env.NODE_VERSION }}
47100
48101 - name : Cache dependencies ⚡
49102 id : cache_dependencies
@@ -68,17 +121,18 @@ jobs:
68121
69122 npm-release :
70123 runs-on : ubuntu-latest
71- needs : [validate ]
124+ needs : [build, lint, tsc ]
72125 if : github.ref == 'refs/heads/main'
73126 env :
74127 NODE_ENV : ' production'
75128
76129 steps :
77130 - name : Checkout 🛎️
78131 uses : actions/checkout@v4
132+
79133 - uses : actions/setup-node@v4
80134 with :
81- node-version : ' 20.x '
135+ node-version : ${{ env.NODE_VERSION }}
82136
83137 - name : Cache dependencies ⚡
84138 id : cache_dependencies
0 commit comments