name: Build Storybook
on:
  workflow_call:
    inputs:
      pr-number:
        required: false
        type: string
jobs:
  Build-Storybook-Assets:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '18.x'
      - name: Install Node Packages
        run: npm i
      - name: Build Storybook Assets
        run: npm run build:storybook
        env:
          NODE_OPTIONS: "--max_old_space_size=8192"
      - name: Add .nojekyll file to allow for node_modules to be included in bundle
        run: touch _site/.nojekyll
      - name: Archive Storybook Assets
        uses: actions/upload-artifact@v4
        with:
          name: storybook-assets
          path: _site
          retention-days: 1
