Skip to content

Setting build storybook GitHub actions #7

Setting build storybook GitHub actions

Setting build storybook GitHub actions #7

Workflow file for this run

name: Storybook CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
storybook-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-storybook
- name: Install dependencies
run: npm install
- name: Build Storybook
run: npm run build-storybook
- name: Publish to Chromatic
id: chromatic
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
run: |
npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN | tee chromatic-output.txt
- name: Extract Chromatic URL
id: extract_url
run: |
url=$(grep -o 'https://[^\"]*' chromatic-output.txt | head -n 1)
echo "storybookUrl=$url" >> $GITHUB_ENV
- name: Comment on PR
uses: thollander/actions-comment-pull-request@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: 'storybook 확인좀용: ${{ env.storybookUrl }}'