diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 4b16dc77..8357e9c4 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -1,22 +1,44 @@ -# Workflow name -name: 'Chromatic Deployment' +name: "Deploy Storybook" -# Event for the workflow -on: pull_request +on: + pull_request: + branches: [feat/v2, develop] + paths: + - '**.stories.tsx' + push: + branches: [feat/v2, develop] + paths: + - '**.stories.tsx' -# List of jobs jobs: - test: - # Operating System + chromatic: runs-on: ubuntu-latest - # Job steps steps: - - uses: actions/checkout@v1 - - run: yarn - #πŸ‘‡ Adds Chromatic as a step in the workflow - - uses: chromaui/action@v1 - # Options required for Chromatic's GitHub Action + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: cache dependencies + id: cache + uses: actions/cache@v4 + with: + path: '**/node_modules' + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-storybook + + - name: depedency install + if: steps.cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Publish to Chromatic + id: chromatic + uses: chromaui/action@latest with: - #πŸ‘‡ Chromatic projectToken, see https://storybook.js.org/tutorials/intro-to-storybook/react/ko/deploy/ to obtain it projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - token: ${{ secrets.GITHUB_TOKEN }} + + - name: comment PR + uses: thollander/actions-comment-pull-request@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + message: 'πŸ”— 배포된 storybook μ£Όμ†Œ: ${{ steps.chromatic.outputs.storybookUrl }}' \ No newline at end of file