Skip to content

Commit b1ad079

Browse files
chore: adding worflow for PR based on extension
1 parent 5659083 commit b1ad079

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and Deploy Storybook
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_call:
8+
secrets:
9+
PUBLISH_STORYBOOK_TOKEN:
10+
required: true
11+
12+
jobs:
13+
build-deploy-storybook:
14+
name: Build and Deploy Storybook
15+
permissions:
16+
contents: write
17+
runs-on: ubuntu-latest
18+
environment: github-pages
19+
defaults:
20+
run:
21+
working-directory: apps/storybook-react
22+
steps:
23+
- name: Checkout and setup environment
24+
uses: MetaMask/action-checkout-and-setup@v1
25+
with:
26+
is-high-risk-environment: false
27+
cache-node-modules: true
28+
29+
- name: Install dependencies
30+
run: yarn --immutable
31+
32+
- name: Build Storybook
33+
run: yarn build-storybook
34+
35+
- name: Deploy to GitHub Pages
36+
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935
37+
with:
38+
personal_token: ${{ secrets.PUBLISH_STORYBOOK_TOKEN }}
39+
publish_dir: ./storybook-static
40+
destination_dir: storybook-static
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build Storybook PR
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-storybook:
9+
name: Build Storybook PR
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
working-directory: apps/storybook-react
14+
steps:
15+
- name: Checkout and setup high risk environment
16+
uses: MetaMask/action-checkout-and-setup@v1
17+
with:
18+
is-high-risk-environment: true
19+
skip-allow-scripts: true
20+
21+
- name: Build storybook
22+
run: yarn build-storybook
23+
24+
- name: Upload 'storybook-build' to S3
25+
if: ${{ vars.AWS_REGION && vars.AWS_IAM_ROLE && vars.AWS_S3_BUCKET }}
26+
uses: metamask/github-tools/.github/actions/upload-s3@1233659b3850eb84824d7375e2e0c58eb237701d
27+
with:
28+
aws-region: ${{ vars.AWS_REGION }}
29+
role-to-assume: ${{ vars.AWS_IAM_ROLE }}
30+
s3-bucket: ${{ vars.AWS_S3_BUCKET }}/${{ github.event.repository.name }}/${{ github.event.pull_request.number }}/storybook-build
31+
path: apps/storybook-react/storybook-static

0 commit comments

Comments
 (0)