diff --git a/.github/workflows/ci-preview.yml b/.github/workflows/ci-preview.yml new file mode 100644 index 0000000000000..e10d1b2a41c66 --- /dev/null +++ b/.github/workflows/ci-preview.yml @@ -0,0 +1,32 @@ +# .github/workflows/ci-preview.yml +name: Deploy PR previews +concurrency: preview-${{ github.ref }} +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed +jobs: + deploy-preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: rharkor/caching-for-turbo@v1.5 + if: github.event.action != 'closed' + + - name: Setup NodeJS + uses: ./.github/actions/setup-node + if: github.event.action != 'closed' + with: + cache-modules: true + install: true + + - uses: rossjrw/pr-preview-action@v1 + with: + source-dir: .preview + preview-branch: gh-pages + umbrella-dir: pr-preview + action: auto diff --git a/.gitignore b/.gitignore index 4e6e4bb29da9f..dbad2c29a22c9 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,8 @@ yarn-error.log* .history .envrc +.preview + *.sublime-workspace **/.vim/ diff --git a/apps/uikit-playground/package.json b/apps/uikit-playground/package.json index d309c2d545994..634e7ef7074f4 100644 --- a/apps/uikit-playground/package.json +++ b/apps/uikit-playground/package.json @@ -5,7 +5,9 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc && vite build", + "build-preview": "yarn .:build-preview && yarn .:build-preview-move", + ".:build-preview": "tsc && vite build", + ".:build-preview-move": "mkdir -p ../../.preview/ && mv ./dist ../../.preview/uikit-playground", "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, diff --git a/turbo.json b/turbo.json index 7ce868eb37070..d5dbe45e3f719 100644 --- a/turbo.json +++ b/turbo.json @@ -2,6 +2,9 @@ "$schema": "https://turborepo.org/schema.json", "globalDependencies": ["tsconfig.base.json", "tsconfig.base.server.json", "tsconfig.base.client.json"], "tasks": { + "build-preview": { + "outputs": ["storybook-static/**", ".storybook/**", "dist/**"] + }, "build": { "dependsOn": ["^build"], "outputs": ["dist/**"]