From a2b43058e0dea4940cef1754c846ecab19143ed7 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 10 Sep 2024 19:01:58 -0300 Subject: [PATCH] chore: publish preview github pages --- .github/workflows/ci-preview.yml | 36 ++++++++++++++++++++++++++++++ .gitignore | 2 ++ apps/uikit-playground/package.json | 4 +++- turbo.json | 4 ++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci-preview.yml diff --git a/.github/workflows/ci-preview.yml b/.github/workflows/ci-preview.yml new file mode 100644 index 0000000000000..2bf96df8b6b73 --- /dev/null +++ b/.github/workflows/ci-preview.yml @@ -0,0 +1,36 @@ +# .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 + + - name: Build + if: github.event.action != 'closed' + run: yarn turbo run build-preview + + - 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..90ff967485edf 100644 --- a/turbo.json +++ b/turbo.json @@ -2,6 +2,10 @@ "$schema": "https://turborepo.org/schema.json", "globalDependencies": ["tsconfig.base.json", "tsconfig.base.server.json", "tsconfig.base.client.json"], "tasks": { + "build-preview": { + "dependsOn": ["^build"], + "outputs": ["storybook-static/**", ".storybook/**", "dist/**"] + }, "build": { "dependsOn": ["^build"], "outputs": ["dist/**"]