Skip to content

Commit

Permalink
ci: setup chromatic
Browse files Browse the repository at this point in the history
  • Loading branch information
pczeglik-iohk committed Jul 1, 2024
1 parent 5ee8bdb commit 89aa6cf
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
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
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 @@ -61,3 +61,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.GH_TOKEN }}
run: npx semantic-release

- name: Chromatic
uses: ./.github/actions/chromatic
with:
TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
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

0 comments on commit 89aa6cf

Please sign in to comment.