Skip to content

Commit

Permalink
ci: add storybook deployment to chromatic
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus-Ende committed Apr 15, 2024
1 parent a400b06 commit c430b93
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Storybook Publish'

on:
push:
branches:
- 'main'

jobs:
storybook-deployment:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: 'npm'

- uses: nrwl/nx-set-shas@v4

- name: Install dependencies
run: |
npm ci
- name: Restore nx cache
id: nxcache
uses: actions/cache@v4
with:
path: node_modules/.cache/nx
key: ${{ runner.os }}-nxcache-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-nxcache-
- name: build storybook
run: nx run sketch:build-storybook

- name: Publish to Chromatic
# see https://github.com/chromaui/action/tags for versions
uses: chromaui/[email protected]
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: ./dist/storybook/sketch
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

**This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)**

## Storybook

Deployed from main: https://661d194a3f6d14d86c328554-yfvvdffiwi.chromatic.com/

Chromatic app: https://www.chromatic.com/builds?appId=661d194a3f6d14d86c328554

## Integrate with editors

Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console
Expand Down
8 changes: 8 additions & 0 deletions chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"projectId": "Project:661d194a3f6d14d86c328554",
"autoAcceptChanges": "main",
"exitOnceUploaded": true,
"externals": ["public/**"],
"onlyChanged": true,
"storybookBuildDir": "dist/storybook/sketch"
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "nx build",
"test": "nx test",
"lint": "nx run-many --all --target=lint --fix --parallel",
"prepare": "husky install"
"prepare": "husky install",
"storybook": "nx run sketch:storybook"
},
"private": true,
"dependencies": {
Expand Down

0 comments on commit c430b93

Please sign in to comment.