From a0e92df82f3e660cd09151a4bf59444d48cc9fb6 Mon Sep 17 00:00:00 2001 From: Giovanni Ravalico <15946771+suddenlyGiovanni@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:58:38 +0100 Subject: [PATCH] Add Chromatic workflow and script in package.json (#578) Signed-off-by: Giovanni Ravalico <15946771+suddenlyGiovanni@users.noreply.github.com> --- .github/workflows/chromatic.yml | 43 +++++++++++++++++++++++++++++++++ packages/ui/package.json | 3 ++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/chromatic.yml diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml new file mode 100644 index 000000000..2a4247ba5 --- /dev/null +++ b/.github/workflows/chromatic.yml @@ -0,0 +1,43 @@ +name: "Chromatic" +on: push +jobs: + chromatic: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: current + + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v3 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Publish to Chromatic + uses: chromaui/action@latest + with: + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + workingDir: packages/ui diff --git a/packages/ui/package.json b/packages/ui/package.json index 7aec76579..0b50a0690 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -11,9 +11,10 @@ }, "type": "module", "scripts": { - "build:storybook": "storybook build", + "build-storybook": "storybook build", "check": "biome check .", "check:fix": "biome check --apply .", + "chromatic": "npx chromatic", "clean": "scripty", "components-add": "pnpm dlx shadcn-ui@latest add", "components-diff": "pnpm dlx shadcn-ui@latest diff",