Skip to content

Commit c309370

Browse files
committed
workflow
1 parent 2b654ba commit c309370

File tree

4 files changed

+74
-21
lines changed

4 files changed

+74
-21
lines changed

.github/workflows/cache.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Cache Node Modules
2+
on:
3+
pull_request:
4+
push:
5+
branches: [ main ]
6+
jobs:
7+
cache_node_modules:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout repository code
11+
uses: actions/checkout@main
12+
- uses: actions/setup-node@main
13+
with:
14+
node-version: '14'
15+
- name: Cache node_modules
16+
id: cache-node-modules
17+
uses: actions/cache@main
18+
with:
19+
path: node_modules
20+
key: node_modules-${{ hashFiles('package-lock.json') }}
21+
22+
- name: Install dependencies
23+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
24+
run: npm install

.github/workflows/release.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
name: Release
2-
32
on:
43
push:
54
branches: [ main ]
6-
75
jobs:
86
release:
97
name: Release
8+
needs: cache_node_modules
109
runs-on: ubuntu-latest
1110
steps:
12-
- uses: actions/checkout@main
13-
- uses: actions/setup-node@v1
11+
- name: Checkout repository code
12+
uses: actions/checkout@main
13+
14+
- name: Load node_modules
15+
id: cache-node-modules
16+
uses: actions/cache@main
1417
with:
15-
node-version: "12.x"
16-
- run: npm install
18+
path: node_modules
19+
key: node_modules-${{ hashFiles('package-lock.json') }}
20+
21+
- name: Install node_modules
22+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
23+
run: npm install
1724
- run: npm run generate
1825
- run: npm run test
1926
- run: npx semantic-release

.github/workflows/storybook.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
name: Build and Deploy
2-
on: [push]
2+
on:
3+
push:
4+
branches: [ main ]
35
jobs:
46
build-and-deploy:
7+
needs: cache_node_modules
58
runs-on: ubuntu-latest
69
env:
710
NODE_OPTIONS: '--max_old_space_size=4096'
@@ -10,17 +13,29 @@ jobs:
1013
uses: actions/checkout@main
1114
with:
1215
persist-credentials: false
13-
- name: Install and Build 🔧
16+
17+
- name: Load node_modules
18+
id: cache-node-modules
19+
uses: actions/cache@main
20+
with:
21+
path: node_modules
22+
key: node_modules-${{ hashFiles('package-lock.json') }}
23+
24+
- name: Install node_modules
25+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
26+
run: npm install
27+
28+
- name: Build 🔧
1429
run: |
15-
npm install
1630
npm run generate
1731
npm run storybook
1832
npm run build-storybook
33+
1934
- name: Deploy 🚀
2035
uses: JamesIves/[email protected]
2136
with:
2237
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23-
BRANCH: main # The branch the action should deploy to.
24-
FOLDER: docs-build # The folder that the build-storybook script generates files.
25-
CLEAN: true # Automatically remove deleted files from the deploy branch
26-
TARGET_FOLDER: docs # The folder that we serve our Storybook files from
38+
BRANCH: main
39+
FOLDER: docs-build
40+
CLEAN: true
41+
TARGET_FOLDER: docs

.github/workflows/test.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
21
name: Test
3-
42
on:
53
pull_request:
64
push:
75
branches: [ main ]
8-
96
jobs:
107
release:
118
name: Test
9+
needs: cache_node_modules
1210
runs-on: ubuntu-latest
1311
steps:
14-
- uses: actions/checkout@main
15-
- uses: actions/setup-node@v1
12+
- name: Checkout repository code
13+
uses: actions/checkout@main
14+
15+
- name: Load node_modules
16+
id: cache-node-modules
17+
uses: actions/cache@main
1618
with:
17-
node-version: "12.x"
18-
- run: npm install
19+
path: node_modules
20+
key: node_modules-${{ hashFiles('package-lock.json') }}
21+
22+
- name: Install node_modules
23+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
24+
run: npm install
25+
1926
- run: npm run generate
20-
- run: npm run test
27+
- run: npm run test

0 commit comments

Comments
 (0)