From b59cb86ef9fd0a39a04b933ddd0ab0ee15096b23 Mon Sep 17 00:00:00 2001 From: Maciek Sitkowski Date: Sun, 26 Nov 2023 03:46:56 +0100 Subject: [PATCH] deploy docs to gh pages --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++-- apps/docs/.storybook/main.ts | 2 +- apps/docs/.storybook/preview.ts | 3 ++ apps/docs/package.json | 4 +-- apps/docs/stories/button.stories.tsx | 1 + package.json | 1 + 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c09345d..0f529c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ jobs: name: 🔍 Detect changes runs-on: ubuntu-latest outputs: + docs: ${{ steps.filter.outputs.docs }} nestjs: ${{ steps.filter.outputs.nestjs }} remix: ${{ steps.filter.outputs.remix }} steps: @@ -24,12 +25,16 @@ jobs: id: filter with: filters: | + docs: + - 'docs/**' + - 'libs/ui/**' nestjs: - 'apps/nestjs/**' - 'libs/types/**' remix: - 'apps/remix/**' - - 'apps/types/**' + - 'libs/types/**' + - 'libs/ui/**' lint: name: ⬣ ESLint @@ -157,7 +162,7 @@ jobs: run: pnpm build deploy-nestjs: - name: 🚀 Deploy NestJS App + name: 🐯 Deploy NestJS App needs: [changes, lint, typecheck, test, e2e, build] if: needs.changes.outputs.nestjs == 'true' && github.ref == 'refs/heads/main' @@ -176,7 +181,7 @@ jobs: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} deploy-remix: - name: 🚀 Deploy Remix App + name: 💿 Deploy Remix App needs: [changes, lint, typecheck, test, e2e, build] if: needs.changes.outputs.remix == 'true' && github.ref == 'refs/heads/main' @@ -193,3 +198,35 @@ jobs: run: flyctl deploy --config ./apps/remix/fly.toml --dockerfile ./apps/remix/Dockerfile --remote-only --build-arg COMMIT_SHA=${{ github.sha }} env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + + deploy-docs: + name: 📜 Deploy Docs + needs: [changes, lint, typecheck, test, e2e, build] + if: needs.changes.outputs.docs == 'true' && github.ref == 'refs/heads/main' + + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v2.4.0 + with: + version: 8 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: 📥 Install Dependencies + run: pnpm install + + - name: 🏗️ Build + run: pnpm build:docs + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: ./apps/docs/build diff --git a/apps/docs/.storybook/main.ts b/apps/docs/.storybook/main.ts index 47efbef..61d0afb 100644 --- a/apps/docs/.storybook/main.ts +++ b/apps/docs/.storybook/main.ts @@ -1,7 +1,7 @@ import type { StorybookConfig } from '@storybook/react-vite' const config: StorybookConfig = { - stories: ['../**/*.stories.@(js|jsx|mjs|ts|tsx)'], + stories: ['../stories/*.stories.@(js|jsx|mjs|ts|tsx)'], addons: [ '@storybook/addon-links', '@storybook/addon-essentials', diff --git a/apps/docs/.storybook/preview.ts b/apps/docs/.storybook/preview.ts index 7f40088..c530f48 100644 --- a/apps/docs/.storybook/preview.ts +++ b/apps/docs/.storybook/preview.ts @@ -15,6 +15,9 @@ const preview: Preview = { docs: { theme: themes.dark, }, + backgrounds: { + default: 'dark', + }, }, decorators: [ withThemeByClassName({ diff --git a/apps/docs/package.json b/apps/docs/package.json index cb654fe..37d9d37 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -3,8 +3,8 @@ "type": "module", "scripts": { "develop": "storybook dev -p 6006", - "build": "storybook build --docs", - "start": "serve storybook-static", + "build": "storybook build -o build", + "start": "serve build", "clean": "rm -rf .turbo && rm -rf node_modules", "lint": "eslint ./stories/*.stories.tsx --max-warnings 0" }, diff --git a/apps/docs/stories/button.stories.tsx b/apps/docs/stories/button.stories.tsx index 2d50a63..6853c85 100644 --- a/apps/docs/stories/button.stories.tsx +++ b/apps/docs/stories/button.stories.tsx @@ -9,6 +9,7 @@ const meta: Meta = { options: ['button', 'submit', 'reset'], }, }, + } export default meta diff --git a/package.json b/package.json index 3bfbc00..6c17205 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "format": "prettier --write .", "lint:fix": "pnpm lint -fix", "lint": "eslint --ext .ts,.tsx ./apps ./libs", + "start:docs": "pnpm -F docs start", "start:nestjs": "pnpm -F nestjs start", "start:remix": "pnpm -F remix start", "start": "pnpm -r start",