Skip to content

perf: Speed up Storybook start time #473

perf: Speed up Storybook start time

perf: Speed up Storybook start time #473

# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: CC0-1.0
name: 'Publish Storybook'
on:
pull_request:
branches: ['**']
paths:
- 'frontend/**'
- '.github/workflows/storybook-publish.yml'
push:
branches: ['main']
paths:
- 'frontend/**'
- '.github/workflows/storybook-publish.yml'
jobs:
deploy:
runs-on: ubuntu-latest
concurrency:
# prettier-ignore
group: chromatic-${{ github.event_name }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Find Storybook comment on PR
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Chromatic
- name: Install dependencies
run: npm ci
working-directory: ./frontend
- name: Build Storybook
run: npx -p @angular/cli ng run capellacollab:build-storybook
working-directory: ./frontend
- name: Run Chromatic
id: chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: ./frontend
storybookBuildDir: ./storybook-static
- name: Create Storybook comment
if: github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
A Storybook preview is available for commit ${{ github.sha }}.
➡️ [View Storybook](${{ steps.chromatic.outputs.storybookUrl }})
➡️ [View Chromatic build](${{ steps.chromatic.outputs.buildUrl }})
edit-mode: replace