Skip to content

Commit

Permalink
chore: chromatic ci/cd 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyoung234 committed Jul 18, 2024
1 parent 6d5446d commit 12af579
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
paths:
- '**/*.stories.tsx'
- '**/*.stories.ts'

defaults:
run:
working-directory: frontend
jobs:
chromatic:
runs-on: ubuntu-latest
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions frontend/chromatic_publish.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 12af579

Please sign in to comment.