Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: setup chromatic #18

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/chromatic/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: deploy chromatic
description: Deploy storybook to Chromatic

inputs:
TOKEN:
description: 'Chromatic token'
required: true

runs:
using: 'composite'

steps:
- name: Install playwright
run: npx playwright install chromium
shell: bash

- name: Tests
run: yarn test-storybook:ci
shell: bash

- name: Publish to Chromatic
if: github.ref != 'refs/heads/main'
uses: chromaui/action@v1
with:
projectToken: ${{ inputs.TOKEN }}
buildScriptName: build-storybook
onlyChanged: true
exitOnceUploaded: true

- name: Publish to Chromatic and auto accept changes
if: github.ref == 'refs/heads/main'
uses: chromaui/action@v1
with:
projectToken: ${{ inputs.TOKEN }}
autoAcceptChanges: true
onlyChanged: true
exitOnceUploaded: true
pczeglik-iohk marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ jobs:

- name: Typecheck
run: yarn type-check

- name: Chromatic
uses: ./.github/actions/chromatic
with:
TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ jobs:
- name: Typecheck
run: yarn type-check

- name: Chromatic
uses: ./.github/actions/chromatic
with:
TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

- name: Build
run: yarn build

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"lint": "yarn eslint --ext .ts,.tsx,.js,.jsx .",
"lint:fix": "yarn eslint --ext .ts,.tsx,.js,.jsx --fix .",
"storybook": "NODE_OPTIONS=--openssl-legacy-provider; start-storybook -p 6006",
"test": "echo \"@lace/ui: no test command specified\"",
"test": "echo \"No test command specified\"",
"test-storybook": "test-storybook",
"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\"",
"type-check": "tsc --noEmit",
Expand Down