diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af6f672..3ad11bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: CI +name: Build & Test on: push: diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml new file mode 100644 index 0000000..1fbe356 --- /dev/null +++ b/.github/workflows/storybook.yml @@ -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 diff --git a/.gitignore b/.gitignore index ffcb518..5299244 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ dist-ssr *.sw? *storybook.log +/dist-storybook \ No newline at end of file diff --git a/apps/web/package.json b/apps/web/package.json index bdb0407..4fc48f0 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -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:*", diff --git a/package.json b/package.json index 908c2bc..af6efea 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/turbo.json b/turbo.json index bf71daa..51532f9 100644 --- a/turbo.json +++ b/turbo.json @@ -10,6 +10,14 @@ "dev": { "cache": false, "persistent": true + }, + "storybook": { + "dependsOn": ["^build"], + "outputs": ["dist/storybook"] + }, + "build-storybook": { + "dependsOn": ["^build"], + "outputs": ["dist/storybook"] } } }