Skip to content

Commit 23412a2

Browse files
Merge pull request #18 from input-output-hk/ci-add-chromatic
ci: setup chromatic
2 parents 5ee8bdb + 99ad04d commit 23412a2

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

.github/actions/chromatic/action.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: deploy chromatic
2+
description: Deploy storybook to Chromatic
3+
4+
inputs:
5+
TOKEN:
6+
description: 'Chromatic token'
7+
required: true
8+
9+
runs:
10+
using: 'composite'
11+
12+
steps:
13+
- name: Install playwright
14+
run: npx playwright install chromium
15+
shell: bash
16+
17+
- name: Tests
18+
run: yarn test-storybook:ci
19+
shell: bash
20+
21+
- name: Publish to Chromatic
22+
if: github.ref != 'refs/heads/main'
23+
uses: chromaui/action@v1
24+
with:
25+
projectToken: ${{ inputs.TOKEN }}
26+
buildScriptName: build-storybook
27+
onlyChanged: true
28+
exitOnceUploaded: true
29+
30+
- name: Publish to Chromatic and auto accept changes
31+
if: github.ref == 'refs/heads/main'
32+
uses: chromaui/action@v1
33+
with:
34+
projectToken: ${{ inputs.TOKEN }}
35+
autoAcceptChanges: true
36+
onlyChanged: true
37+
exitOnceUploaded: true

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ jobs:
5454

5555
- name: Typecheck
5656
run: yarn type-check
57+
58+
- name: Chromatic
59+
uses: ./.github/actions/chromatic
60+
with:
61+
TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

.github/workflows/publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ jobs:
5353
- name: Typecheck
5454
run: yarn type-check
5555

56+
- name: Chromatic
57+
uses: ./.github/actions/chromatic
58+
with:
59+
TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
60+
5661
- name: Build
5762
run: yarn build
5863

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"lint": "yarn eslint --ext .ts,.tsx,.js,.jsx .",
3333
"lint:fix": "yarn eslint --ext .ts,.tsx,.js,.jsx --fix .",
3434
"storybook": "NODE_OPTIONS=--openssl-legacy-provider; start-storybook -p 6006",
35-
"test": "echo \"@lace/ui: no test command specified\"",
35+
"test": "echo \"No test command specified\"",
3636
"test-storybook": "test-storybook",
3737
"test-storybook:ci": "NODE_OPTIONS=--openssl-legacy-provider; export STORYBOOK_TEST=1; concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"yarn build-storybook && http-server storybook-static --port 6006\" \"wait-on http://127.0.0.1:6006/ && yarn test-storybook\"",
3838
"type-check": "tsc --noEmit",

0 commit comments

Comments
 (0)