Skip to content

Commit e8dfa01

Browse files
Storybook adjustments (#1483)
1 parent 6965e87 commit e8dfa01

File tree

4 files changed

+84
-38
lines changed

4 files changed

+84
-38
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Clean pr storybook
5+
6+
on:
7+
pull_request:
8+
types: [closed]
9+
branches: [main, release/**, next/**]
10+
11+
jobs:
12+
storybook:
13+
if: "contains(github.event.pull_request.labels.*.name, 'Build: Storybook')"
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [12.x]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
ref: gh-pages
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
registry-url: 'https://registry.npmjs.org'
29+
- run: |
30+
git config user.name github-actions
31+
git config user.email [email protected]
32+
git rm -r next/pr/${{ github.event.number }}
33+
git commit -m "PR ${{ github.event.number }} closed"
34+
git push

.github/workflows/pr-storybook.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Deploy pr storybook
5+
6+
on:
7+
pull_request:
8+
types: [opened, labeled, synchronize, reopened]
9+
branches: [main, release/**, next/**]
10+
11+
jobs:
12+
storybook:
13+
if: "contains(github.event.pull_request.labels.*.name, 'Build: Storybook')"
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [12.x]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
registry-url: 'https://registry.npmjs.org'
27+
28+
- name: Build 🛠
29+
run: |
30+
npm install -g yarn lerna
31+
yarn
32+
yarn build
33+
yarn storybook:build
34+
35+
- name: Deploy mgt.dev/next/pr/${{ github.event.number }} 🚀
36+
uses: JamesIves/[email protected]
37+
with:
38+
branch: gh-pages
39+
folder: storybook-static
40+
target-folder: next/pr/${{ github.event.number }}
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Comment PR
44+
uses: thollander/actions-comment-pull-request@v1
45+
with:
46+
message: 'The updated storybook is available [here](https://mgt.dev/next/pr/${{ github.event.number }})'
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 1 addition & 37 deletions
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: PR (Build + Storybook)
4+
name: Build pr
55

66
on:
77
pull_request:
@@ -38,39 +38,3 @@ jobs:
3838
with:
3939
name: bundle
4040
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/storybook.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ jobs:
3737
branch: gh-pages
3838
folder: storybook-static
3939
target-folder: next
40-
clean-exclude: next/pr
40+
clean-exclude: pr
41+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)