From 12af579970f7210328e19ada38d9837ebb34454e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=89=E1=85=A9=E1=86=AB=E1=84=8C=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=8B=E1=85=A7=E1=86=BC?= Date: Fri, 19 Jul 2024 00:48:47 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20chromatic=20ci/cd=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/chromatic.yml | 12 ++++++++++-- frontend/chromatic_publish.sh | 2 ++ frontend/package.json | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 frontend/chromatic_publish.sh 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",