Skip to content

Commit

Permalink
ci: add storybook action
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrad77 committed Nov 9, 2024
1 parent aa0820e commit dd18683
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Build & Test

on:
push:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Storybook

on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- uses: pnpm/action-setup@v3
with:
version: 8

- name: Build Storybook
run: pnpm run build-storybook

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist-storybook
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ dist-ssr
*.sw?

*storybook.log
/dist-storybook
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview",
"lint": "eslint . --config ../../packages/eslint-config/web.config.mjs",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
"build-storybook": "storybook build -o ../../dist-storybook"
},
"dependencies": {
"@rentment/ui": "workspace:*",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"test": "cross-env FORCE_COLOR=1 turbo run test",
"typecheck": "turbo run typecheck",
"storybook": "turbo run storybook --parallel",
"build-storybook": "turbo run build-storybook",
"prepare": "husky"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"dev": {
"cache": false,
"persistent": true
},
"storybook": {
"dependsOn": ["^build"],
"outputs": ["dist/storybook"]
},
"build-storybook": {
"dependsOn": ["^build"],
"outputs": ["dist/storybook"]
}
}
}

0 comments on commit dd18683

Please sign in to comment.