diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 556646bd..23cee772 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -6,7 +6,9 @@ on: paths: - '**/*.stories.tsx' - '**/*.stories.ts' - +defaults: + run: + working-directory: frontend jobs: chromatic: runs-on: ubuntu-latest @@ -16,6 +18,11 @@ jobs: with: fetch-depth: 0 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.15.1' + - name: Cache dependencies id: cache uses: actions/cache@v4 @@ -25,12 +32,13 @@ jobs: - name: Install dependencies if: steps.cache.outputs.cache-hit != 'true' - run: yarn + run: yarn install --frozen-lockfile - name: Publish to Chromatic id: chromatic uses: chromaui/action@latest with: + workingDir: frontend projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - name: Comment PR diff --git a/frontend/chromatic_publish.sh b/frontend/chromatic_publish.sh new file mode 100644 index 00000000..beb651a5 --- /dev/null +++ b/frontend/chromatic_publish.sh @@ -0,0 +1,2 @@ +CHROMATIC_TOKEN=$(grep CHROMATIC_TOKEN .env.development | cut -d "=" -f2) +npx chromatic --project-token=$CHROMATIC_TOKEN --exit-once-uploaded --allow-console-errors \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index e271c029..7db7e657 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,7 +9,8 @@ "lint:styled": "stylelint './src/**/*.styled.ts' --fix", "test": "jest --watchAll", "storybook": "storybook dev -p 6006", - "build-storybook": "storybook build" + "build-storybook": "storybook build", + "chromatic": "bash ./chromatic_publish.sh" }, "dependencies": { "@emotion/react": "^11.11.4",