Skip to content

Commit 6965e87

Browse files
Adding the storybook auto deployment (#1477)
* Adding the storybook auto deployment * Building storybook * Adding pr folder * Downgraded to 4.1.1 for deploy action * Removing environment requirements * Making dependencies between steps * Testing PR Commenting * Renaming actions
1 parent 644b051 commit 6965e87

File tree

5 files changed

+44
-5
lines changed

5 files changed

+44
-5
lines changed

.github/workflows/next.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Build CI
4+
name: Release next/*
55

66
on:
77
push:

.github/workflows/pr.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Build CI
4+
name: PR (Build + Storybook)
55

66
on:
77
pull_request:
@@ -26,13 +26,51 @@ jobs:
2626
- run: node scripts/setVersion.js --next
2727
- run: yarn build
2828
- run: yarn run pack
29+
2930
- name: Upload a Build Artifact - package
3031
uses: actions/upload-artifact@v2
3132
with:
3233
name: npm-packages
3334
path: artifacts/*
35+
3436
- name: Upload a Build Artifact - bundle
3537
uses: actions/upload-artifact@v2
3638
with:
3739
name: bundle
3840
path: packages/mgt/dist/bundle
41+
42+
storybook:
43+
runs-on: ubuntu-latest
44+
needs: build
45+
46+
strategy:
47+
matrix:
48+
node-version: [12.x]
49+
50+
steps:
51+
- uses: actions/checkout@v2
52+
- name: Use Node.js ${{ matrix.node-version }}
53+
uses: actions/setup-node@v1
54+
with:
55+
node-version: ${{ matrix.node-version }}
56+
registry-url: 'https://registry.npmjs.org'
57+
58+
- name: Build 🛠
59+
run: |
60+
npm install -g yarn lerna
61+
yarn
62+
yarn build
63+
yarn storybook:build
64+
65+
- name: Deploy mgt.dev/next/pr/${{ github.event.number }} 🚀
66+
uses: JamesIves/[email protected]
67+
with:
68+
branch: gh-pages
69+
folder: storybook-static
70+
target-folder: next/pr/${{ github.event.number }}
71+
72+
- name: Comment PR
73+
uses: thollander/actions-comment-pull-request@v1
74+
with:
75+
message: 'The updated storybook is available [here](https://mgt.dev/next/pr/${{ github.event.number }})'
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/push-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Build CI
4+
name: Release latest
55

66
on:
77
push:

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Build CI
4+
name: Release main
55

66
on:
77
push:

.github/workflows/storybook.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Build CI
4+
name: Deploy main storybook
55

66
on:
77
push:
@@ -37,3 +37,4 @@ jobs:
3737
branch: gh-pages
3838
folder: storybook-static
3939
target-folder: next
40+
clean-exclude: next/pr

0 commit comments

Comments
 (0)