์คํ ๋ฆฌ๋ถ์ ๋ง๋ค์ด์ chromatic CLI๋ก ๋ฐฐํฌํ๋ ์์ ์ ํ์๋ค.
์ปดํฌ๋ํธ๋ค์ ๋ง๋ค๋ ค๊ณ main <= 21-design-system <= #์ด์๋ฒํธ-design-system-์์ ์ค์ธ-์ปดํฌ๋ํธ ๋ก ๋ธ๋์น๊ฐ ๋๋์ด์ ธ ์๋ค.
์์ ์ค์ธ ์ปดํฌ๋ํธ๋ค์ ํ๋์ฉ ๋ง๋ค๋ฉด ๋์์ธ ์์คํ ์ ํฉ์ณ์ฃผ๊ณ ์ด๋ฅผ ๋ฉ์ธ์ ํฉ์ณ์ฃผ๋ ๋ฐฉ์์ธ๋ฐ, ํ์ฌ๋ pr์ ๋ ๋ฆฌ๋ฉด main๊ณผ์ ๋น๊ต์์๋ง action์ด ๋์ํ๋ ๊ฒ์ด์๋ค.
ํ์ฌ action์ ์ดํด๋ณด์.
name: "Chromatic Deployment"
on:
pull_request:
branches: [main, 21-design-system]
paths:
- packages/design-system/src/**
jobs:
chromatic-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ">=20"
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependency
run: pnpm install -no-frozen-lockfile
working-directory: packages/design-system
- name: Publish Chromatic
id: chromatic
uses: chromaui/action@v1
with:
workingDir: apps/storybook
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.SECRET_GITHUB }}
- name: Create comment PR
uses: thollander/actions-comment-pull-request@v1
env:
GITHUB_TOKEN: ${{ secrets.SECRET_GITHUB }}
with:
message: "๐storybook: ${{ steps.chromatic.outputs.storybookUrl }}"
์์ฑํ ๋๋ก๋ผ๋ฉด 21-design-system์ด๋ main์ผ๋ก pr์ ๋ ๋ฆฌ๋ฉด chromatic์ผ๋ก ์คํ ๋ฆฌ๋ถ์ ๋ฐฐํฌํด์ฃผ๊ณ , ํด๋น pr์ ์ฐ๋ฌ์ message์ธ "๐storybook: ${{ steps.chromatic.outputs.storybookUrl }}"๋ฅผ ๋ฌ์์ค ๊ฑฐ๋ผ ๊ธฐ๋ํ์ง๋ง,
๊ฒฐ๊ณผ๋ ๊ณ์ ๋ฉ์ธ #39๋ฅผ ๋น๊ตํ๊ณ ์๋ pr #41์ ์ฝ๋ฉํธ๊ฐ ๋ฌ๋ฆฌ๊ณ ์๋ ์ํฉ.
์ฌ๋ฌ ์ค์ ๋ค์ ๊ณ์ ๊ฑด๋๋ ค๋ดค๋ค.
ํ์ฌ ๋ธ๋์น๋ฅผ ์์๋ด๋ step์ ์ถ๊ฐํ๊ฑฐ๋, ํ์ฌ ๋ธ๋์น๋ก ์ด์ ๋ฒํธ๋ฅผ ์ฐพ์์ ๊ทธ ๋ฒํธ์ ์ฝ๋ฉํธ๊ฐ ๋ฌ๋ฆฌ๋๋ก ์ค์ ํ๊ฑฐ๋...
๊ทผ๋ฐ ๋ค ์์ฉ์ด ์์๋ค.๐ฅฒ
๊ทธ๋ฌ๋ค ๊ฒ์ํ๋ค ๋ค์ ๊ธ์์ ํํธ๋ฅผ ์ป์๋ค.
I realized that this Github Actions file was on the main branch, and Github uses the actions that are configured for the branch that is getting pushed. It doesn't do anything if name-of-my-branch has different on: push: branches: specified in its .github/workflows/build_and_test.yml....
๋ฉ์ธ ๋ธ๋์น์ .github์ ์ํฌ ํ๋ก์ด๊ฐ ์์ด์ ๊นํ๋ธ๋ ํด๋น ๋ธ๋์น์ ์ค์ ์ ๊ธฐ์ค์ผ๋ก actions๊ฐ ๋์ํ๋ค๋ ๊ฒ์ด๋ค.
ํ์ฌ ์์ ์ค์ธ ๋ธ๋์น์ ์์์ ์์ฑํ๋ yml ํ์ผ์ ์์ฑํด์ฃผ๋ ์ ๋์ํ๋ค.
๐ ๋ง์น๋ฉด์
์์ธ๋ก ๊ฐ๋จํ๊ฒ ํด๊ฒฐํ ์ ์์๋ ๋ฌธ์ ์๋ค.
์์ผ๋ก๋ ํ์ฌ github actions ๋ธ๋์น๊ฐ ์ค์ ๊ธฐ์ค์ด๋ผ๋ ๊ฑธ ์ผ๋ํ๊ณ ์์ฑํ๋๋ก ํด์ผ๊ฒ ๋ค.
๐ Reference
https://stackoverflow.com/questions/64565482/github-action-not-triggered-when-pushing-to-branch