-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (53 loc) Β· 2.02 KB
/
storybook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: 'Storybook Deployment'
on:
pull_request:
branches:
- develop
permissions:
contents: write
pull-requests: write
jobs:
storybook:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}-storybook
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}-storybook
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Publish to Chromatic
id: chromatic
uses: chromaui/action@v10
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
onlyChanged: true
autoAcceptChanges: true
- name: Check for Storybook file changes
id: check_changes
run: |
echo "κΈ°μ€(base) 컀λ°: ${{ github.event.pull_request.base.sha }}"
echo "νμ¬(head) 컀λ°: ${{ github.event.pull_request.head.sha }}"
# baseμ head μ»€λ° μ¬μ΄μ λ³κ²½λ νμΌ λͺ©λ‘μμ μνλ λλ ν 리μ νμΌμ΄ μλμ§ νμΈ
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -E '(^\.storybook/|^src/stories/)'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Comment PR
if: github.event_name == 'pull_request' && steps.check_changes.outputs.changed == 'true'
uses: thollander/actions-comment-pull-request@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: 'π° Storybook λ°°ν¬κ° μλ£λμμ΅λλ€! π ${{ steps.chromatic.outputs.storybookUrl }}'