Skip to content

Commit

Permalink
Publish Storybook for PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Jul 2, 2024
1 parent 31268aa commit 12b305b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ jobs:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

publish-storybook-pr:
name: Publish Storybook to `pr/${{ github.event.number }}` folder
needs: lint-build-test
if: ${{ github.event_name == 'pull_request' }}
permissions:
contents: write
uses: ./.github/workflows/publish-github-pages.yml
with:
build_script: yarn workspace @metamask/snaps-sdk build && yarn workspace @metamask/snaps-storybook build && yarn workspace @metamask/snaps-sdk build:storybook
publish_dir: ./packages/snaps-sdk/storybook-static
destination_dir: storybook/pr/${{ github.event.number }}
secrets:
PUBLISH_PAGES_TOKEN: ${{ secrets.PUBLISH_PAGES_TOKEN }}

publish-staging-simulator:
name: Publish Snaps Simulator to `staging` folder
needs: lint-build-test
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/publish-storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
workflow_call:
secrets:
PUBLISH_PAGES_TOKEN:
required: true

jobs:
publish-storybook-pr:
name: Publish Storybook to `pr` folder
needs: lint-build-test
permissions:
contents: write
uses: ./.github/workflows/publish-github-pages.yml
with:
build_script: yarn workspace @metamask/snaps-simulator build
publish_dir: ./packages/snaps-simulator/dist/webpack/main
destination_dir: snaps-simulator/staging
secrets:
PUBLISH_PAGES_TOKEN: ${{ secrets.PUBLISH_PAGES_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ packages/examples/examples/webpack/index.html

# Ubuntu package files
.deb

# Storybook
storybook-static
1 change: 1 addition & 0 deletions packages/snaps-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-sdk",
"build": "tsup --clean && yarn build:types",
"build:storybook": "storybook build",
"build:types": "tsc --project tsconfig.build.json",
"clean": "rimraf '*.tsbuildinfo' 'dist'",
"publish:preview": "yarn npm publish --tag preview",
Expand Down

0 comments on commit 12b305b

Please sign in to comment.