Skip to content

Commit

Permalink
🧹 Chromatic CI/CD 작성 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyMan0 authored Jan 23, 2024
1 parent e73b008 commit 4917936
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 350 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: yarn

- name: Node.js 설치
uses: actions/setup-node@v4
Expand Down Expand Up @@ -60,14 +62,3 @@ jobs:
target-branch: main
- name: Test get variable exported by push-to-another-repository
run: echo $DESTINATION_CLONED_DIRECTORY

github-bot:
runs-on: ubuntu-latest
needs: [chromatic, vercel]
steps:
- name: PR 코멘트로 Preview URL 남기기
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Storybook url: ${{ needs.chromatic.outputs.storybook_url }}
vercel url: ${{ needs.vercel.outputs.vercel_url }}
44 changes: 44 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Preview

on:
pull_request:
branches: ['main']

jobs:
chromatic-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Node.js 설치
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: yarn-deps-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-deps-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn

- name: Chromatic에 배포
id: chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
onlyChanged: true
autoAcceptChanges: true
# PR comment
- name: comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: '🚀storybook: ${{ steps.chromatic.outputs.storybookUrl }}'
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# logs
logs
*.log

# dependencies
/node_modules
/.pnp
Expand Down Expand Up @@ -34,3 +38,4 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

Loading

0 comments on commit 4917936

Please sign in to comment.