gitscope
← marzneshin / v0.7.2 / .github/workflows/chromatic.yml
https://dev.kronoz.win/r/marzneshin.git
.github/workflows/chromatic.yml · YAML
Blame Raw
 1name: Chromatic
 2
 3on: workflow_call
 4
 5concurrency:
 6  group: ${{ github.workflow }}-${{ github.ref }}-chromatic
 7  cancel-in-progress: true
 8
 9permissions:
10  pull-requests: write
11  actions: write
12  contents: read
13
14jobs:
15  chromatic:
16    name: Chromatic
17    runs-on: ubuntu-latest
18    env:
19      CI: true
20    defaults:
21      run:
22        working-directory: ./dashboard
23    steps:
24      - uses: actions/checkout@v4
25        with:
26          fetch-depth: 0
27
28      - uses: pnpm/action-setup@v3
29        name: Install pnpm
30        with:
31          version: 8
32          run_install: false
33      - name: Get pnpm store directory
34        shell: bash
35        run: |
36          echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV          
37
38      - uses: actions/cache@v3
39        name: Setup pnpm cache
40        with:
41          path: ${{ env.STORE_PATH }}
42          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
43          restore-keys: |
44            ${{ runner.os }}-pnpm-store-            
45
46      - name: 📥 Install deps
47        run: pnpm install
48
49      - name: Build Storybook
50        run: pnpm run build-storybook
51
52      - name: ⚡ Run chromatic
53        uses: chromaui/action@latest
54        id: chromatic
55        with:
56          projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
57          exitZeroOnChanges: true
58          workingDir: ./dashboard 
59          autoAcceptChanges: "main"
60          exitOnceUploaded: true
61          onlyChanged: true
62          skip: "@(renovate/**|dependabot/**)"
63          zip: true
64
65      - name: Publish Chromatic Action Summary
66        run: echo -e "| Results |  |\n| --- | --- |\n| Build Results | ${{steps.chromatic.outputs.buildUrl}} |\n| Storybook Preview | ${{steps.chromatic.outputs.storybookUrl}} |\n| Component Count | ${{steps.chromatic.outputs.componentCount}} |" >> $GITHUB_STEP_SUMMARY
67
68      - name: Publish Chromatic Link in the comments
69        uses: dannyhw/storybook-chromatic-link-comment@v0.11
70        with:
71          github-token: ${{ secrets.GITHUB_TOKEN }}
72          review-url: ${{ steps.chromatic.outputs.url }}
73          build-url: ${{ steps.chromatic.outputs.buildUrl }}
74          storybook-url: ${{ steps.chromatic.outputs.storybookUrl }}