OperationCode/front-end

View on GitHub
.github/workflows/chromatic.yml

Summary

Maintainability
Test Coverage
# .github/workflows/chromatic.yml

# Workflow name
name: ci

# Event for the workflow
on: push

# List of jobs
jobs:
  chromatic-deployment:
    runs-on: ubuntu-latest

    steps:
      - name: Begin CI...
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Read .nvmrc
        run: echo ::set-output name=NVMRC::$(cat .nvmrc)
        id: nvm

      - name: Use Node
        uses: actions/setup-node@v1
        with:
          always-auth: true
          registry-url: https://registry.npmjs.org
          node-version: '${{ steps.nvm.outputs.NVMRC }}'

      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - name: Use cached node_modules
        uses: actions/cache@v2
        id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: Install dependencies
        run: yarn install --frozen-lockfile --non-interactive

      - name: Publish to Chromatic
        uses: chromaui/action@v1
        with:
          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
          autoAcceptChanges: main
          token: ${{ secrets.GITHUB_TOKEN }}
          buildScriptName: storybook:build