Skip to content

Commit da1d268

Browse files
committed
feat: add publish to chromatic and workflow to do so automatically
1 parent ae2214f commit da1d268

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

.github/workflows/chromatic.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Chromatic Publish'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
chromatic-deployment:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Use Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 'lts/*'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Publish to Chromatic
28+
uses: chromaui/action@v1
29+
with:
30+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
autoAcceptChanges: 'main'
33+
exitZeroOnChanges: true

.storybook/manager-head.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<meta name="description" content="These are common component use for React applications based on GDS and govuk-frontend" key="desc" />
2+
<meta name="robots" content="noindex" />

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ npm install @hmlr/govuk-react-components-library
2222

2323
## Components
2424

25+
You can explore the [components in chromatic](https://67da9f53fd479dc895c4293f-davohxhxay.chromatic.com/).
26+
2527
Note that any component with a `👈🏽` below means that - This component will need javascript to be enabled because of the transitions present in the components using `createAll` or `initAll` recommended by [`govuk-frontend` documentation](https://frontend.design-system.service.gov.uk/configure-components/)
2628

2729
The Components includes:

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"format": "prettier --ignore-path .gitignore --write '**/*.+(js|mjs|ts|tsx|json|css|scss|html|md)'",
3030
"prepare": "husky",
3131
"release": "standard-version",
32-
"uml": "tsuml2 --glob './src/**/\\!(*.spec|*.test|TestUtilities|JestSetup).[t]s?(x)' -o './assets/uml-diagram.svg'"
32+
"uml": "tsuml2 --glob './src/**/\\!(*.spec|*.test|TestUtilities|JestSetup).[t]s?(x)' -o './assets/uml-diagram.svg'",
33+
"chromatic": "npx chromatic --exit-zero-on-changes"
3334
},
3435
"repository": {
3536
"type": "git",
@@ -93,6 +94,7 @@
9394
"autoprefixer": "^10.4.21",
9495
"babel-jest": "^29.7.0",
9596
"bootstrap": "^5.3.3",
97+
"chromatic": "^11.27.0",
9698
"css-loader": "^7.1.2",
9799
"deep-iterator": "^1.1.0",
98100
"eslint": "^9.22.0",

0 commit comments

Comments
 (0)