Skip to content

chore: create storybook build on PR #613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build-storybook-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Deploy Storybook

on:
push:
branches:
- main
workflow_call:
secrets:
PUBLISH_STORYBOOK_TOKEN:
required: true

jobs:
build-deploy-storybook:
name: Build and Deploy Storybook
permissions:
contents: write
runs-on: ubuntu-latest
environment: github-pages
defaults:
run:
working-directory: apps/storybook-react
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: false
cache-node-modules: true

- name: Build required packages
working-directory: .
run: |
yarn workspace @metamask/design-tokens build
yarn workspace @metamask/design-system-tailwind-preset build
yarn workspace @metamask/design-system-react build

- name: Build Storybook
run: yarn build-storybook

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@de7ea6f8efb354206b205ef54722213d99067935
with:
personal_token: ${{ secrets.PUBLISH_STORYBOOK_TOKEN }}
publish_dir: ./storybook-static
destination_dir: storybook-static
38 changes: 38 additions & 0 deletions .github/workflows/build-storybook-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Storybook PR

on:
pull_request:
workflow_dispatch:

jobs:
build-storybook:
name: Build Storybook PR
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/storybook-react
steps:
- name: Checkout and setup environment
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: true
cache-node-modules: true

- name: Build required packages
working-directory: .
run: |
yarn workspace @metamask/design-tokens build
yarn workspace @metamask/design-system-tailwind-preset build
yarn workspace @metamask/design-system-react build

- name: Build storybook
run: yarn build-storybook

- name: Upload 'storybook-build' to S3
if: ${{ vars.AWS_REGION && vars.AWS_IAM_ROLE && vars.AWS_S3_BUCKET }}
uses: metamask/github-tools/.github/actions/upload-s3@1233659b3850eb84824d7375e2e0c58eb237701d
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_IAM_ROLE }}
s3-bucket: ${{ vars.AWS_S3_BUCKET }}/${{ github.event.repository.name }}/${{ github.event.pull_request.number }}/storybook-build
path: apps/storybook-react/storybook-static
Loading