-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (104 loc) Β· 3.69 KB
/
storybook.yaml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: 'μ€ν λ¦¬λΆ λ°°ν¬ μλν'
on:
pull_request:
branches:
- main
- 'feature/**'
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: yarn
- name: Get installed Playwright version
id: playwright-version
run: echo "::set-output name=version::$(yarn why --json @playwright/test | grep -h 'workspace:.' | jq --raw-output '.children[].locator' | sed -e 's/@playwright\/test@.*://')"
- uses: actions/cache@v3
id: playwright-cache
with:
path: '~/.cache/ms-playwright'
key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}'
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright's dependencies
# if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Build Storybook
run: yarn build-storybook --quiet
- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && yarn test-storybook"
chromatic-deploy:
needs: test
runs-on: ubuntu-latest
outputs:
storybookUrl: ${{ steps.chromatic_publish.outputs.storybookUrl }}
buildUrl: ${{ steps.chromatic_publish.outputs.buildUrl }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install NodeJs
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Setup Package Version
id: yarn-cached-version
run: echo YARN_VERSION=$(cat package.json | jq -r '.packageManager') >> $GITHUB_OUTPUT
- name: Yarn Cache - PnP
uses: actions/cache@v2
with:
path: |
.yarn/cache
.pnp.*
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ steps.set-version.outputs.YARN_VERSION }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-
- name: Install dependencies
run: yarn install --check-cache
- name: Publish to Chromatic
id: chromatic_publish
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
onlyChanged: true
autoAcceptChanges: true
github-bot:
needs: chromatic-deploy
runs-on: ubuntu-latest
steps:
- name: Format Message
id: format_comment_message
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
function parseMessage(){
return `
| λΆλ₯ | λλ©μΈ |
| :--- | ---: |
| ν리뷰 | ${{needs.chromatic-deploy.outputs.storybookUrl}} |
| λΉλURL | ${{needs.chromatic-deploy.outputs.buildUrl}} |
`
}
const comments = [
`## μ€ν λ¦¬λΆ λ°°ν¬νλ©΄ 미리보기`,
`π₯ **λ°°ν¬λ νλ©΄μ νμΈν΄λ³΄μΈμ!** : `,
parseMessage()
].join('\n');
core.setOutput('comment', comments);
- name: comment PR
uses: thollander/actions-comment-pull-request@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: ${{ steps.format_comment_message.outputs.comment}}