Skip to content

Commit 12b305b

Browse files
committed
Publish Storybook for PRs
1 parent 31268aa commit 12b305b

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.github/workflows/main.yml

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ jobs:
2727
secrets:
2828
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2929

30+
publish-storybook-pr:
31+
name: Publish Storybook to `pr/${{ github.event.number }}` folder
32+
needs: lint-build-test
33+
if: ${{ github.event_name == 'pull_request' }}
34+
permissions:
35+
contents: write
36+
uses: ./.github/workflows/publish-github-pages.yml
37+
with:
38+
build_script: yarn workspace @metamask/snaps-sdk build && yarn workspace @metamask/snaps-storybook build && yarn workspace @metamask/snaps-sdk build:storybook
39+
publish_dir: ./packages/snaps-sdk/storybook-static
40+
destination_dir: storybook/pr/${{ github.event.number }}
41+
secrets:
42+
PUBLISH_PAGES_TOKEN: ${{ secrets.PUBLISH_PAGES_TOKEN }}
43+
3044
publish-staging-simulator:
3145
name: Publish Snaps Simulator to `staging` folder
3246
needs: lint-build-test
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
workflow_call:
3+
secrets:
4+
PUBLISH_PAGES_TOKEN:
5+
required: true
6+
7+
jobs:
8+
publish-storybook-pr:
9+
name: Publish Storybook to `pr` folder
10+
needs: lint-build-test
11+
permissions:
12+
contents: write
13+
uses: ./.github/workflows/publish-github-pages.yml
14+
with:
15+
build_script: yarn workspace @metamask/snaps-simulator build
16+
publish_dir: ./packages/snaps-simulator/dist/webpack/main
17+
destination_dir: snaps-simulator/staging
18+
secrets:
19+
PUBLISH_PAGES_TOKEN: ${{ secrets.PUBLISH_PAGES_TOKEN }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,6 @@ packages/examples/examples/webpack/index.html
7878

7979
# Ubuntu package files
8080
.deb
81+
82+
# Storybook
83+
storybook-static

packages/snaps-sdk/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
5353
"lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-sdk",
5454
"build": "tsup --clean && yarn build:types",
55+
"build:storybook": "storybook build",
5556
"build:types": "tsc --project tsconfig.build.json",
5657
"clean": "rimraf '*.tsbuildinfo' 'dist'",
5758
"publish:preview": "yarn npm publish --tag preview",

0 commit comments

Comments
 (0)