From 1e1557d29d68a16e80b67ee664ba8a3b846741e6 Mon Sep 17 00:00:00 2001 From: Andrey Yamanov Date: Mon, 31 Jul 2023 15:06:23 +0200 Subject: [PATCH 1/2] chore: migrate deployments to vercel --- .github/workflows/main.yml | 16 +++++++--------- .github/workflows/pull-request.yml | 10 ++++++---- package.json | 1 + pnpm-lock.yaml | 7 +++++++ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2fa56e06..4d743f2d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,13 +94,8 @@ jobs: needs: publish if: needs.publish.outputs.published == 'true' runs-on: ubuntu-latest - environment: - name: Docs Production - url: ${{ steps.publish_docs.outputs.NETLIFY_PREVIEW_URL }} env: NODE_OPTIONS: --max-old-space-size=4096 - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} steps: - uses: actions/checkout@v2 @@ -129,10 +124,13 @@ jobs: - name: Build Docs run: pnpm build-docs --quiet - - name: Deploy docs to Netlify - uses: South-Paw/action-netlify-deploy@v1.2.1 + - name: Deploy docs to Vercel + id: publish_docs + uses: amondnet/vercel-action@v20 with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} - netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }} - netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }} + vercel-org-id: cube-dev + vercel-project-id: cube-ui-kit + vercel-args: '--prod' build-dir: ./storybook-docs diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 525fd0448..7c5b16238 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -201,13 +201,15 @@ jobs: - name: Build Docs run: pnpm build-docs --quiet - - name: Deploy docs to Netlify + - name: Deploy docs to Vercel id: publish_docs - uses: South-Paw/action-netlify-deploy@v1.2.1 + uses: amondnet/vercel-action@v20 with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} - netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }} - netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }} + vercel-org-id: cube-dev + vercel-project-id: cube-ui-kit + vercel-args: '--prod' draft: true build-dir: ./storybook-docs comment-on-commit: true diff --git a/package.json b/package.json index 31521d1bc..258864558 100644 --- a/package.json +++ b/package.json @@ -124,6 +124,7 @@ "storybook": "^7.0.17", "tiny-invariant": "^1.3.1", "valid-url": "^1.0.9", + "vercel-action@v20": "link:amondnet/vercel-action@v20", "vite": "^4.3.5" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab02bbe3c..b902edbf4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,9 @@ lockfileVersion: '6.0' +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + overrides: '@testing-library/user-event': 14.2.0 @@ -208,6 +212,9 @@ dependencies: valid-url: specifier: ^1.0.9 version: 1.0.9 + vercel-action@v20: + specifier: link:amondnet/vercel-action@v20 + version: link:amondnet/vercel-action@v20 vite: specifier: ^4.3.5 version: 4.3.5(@types/node@18.14.0) From d46866c381900d4bfbbdc1c194d3e28d30a1387b Mon Sep 17 00:00:00 2001 From: Andrey Yamanov Date: Mon, 31 Jul 2023 15:08:15 +0200 Subject: [PATCH 2/2] chore: migrate deployments to vercel * 2 --- .github/workflows/main.yml | 46 -------------------- .github/workflows/pull-request.yml | 67 ------------------------------ 2 files changed, 113 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d743f2d0..854e05397 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -88,49 +88,3 @@ jobs: exitOnceUploaded: true autoAcceptChanges: true projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - - deploy-docs: - name: 'Deploy Latest documentation' - needs: publish - if: needs.publish.outputs.published == 'true' - runs-on: ubuntu-latest - env: - NODE_OPTIONS: --max-old-space-size=4096 - steps: - - uses: actions/checkout@v2 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - - uses: actions/cache@v2 - name: Download storybook cache - with: - path: | - **/node_modules/.cache - key: ${{ runner.os }}-storybook-${{ github.run_id }} - restore-keys: | - ${{ runner.os }}-storybook - - - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Build Docs - run: pnpm build-docs --quiet - - - name: Deploy docs to Vercel - id: publish_docs - uses: amondnet/vercel-action@v20 - with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - github-token: ${{ secrets.GITHUB_TOKEN }} - vercel-org-id: cube-dev - vercel-project-id: cube-ui-kit - vercel-args: '--prod' - build-dir: ./storybook-docs diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 7c5b16238..b2806e3ad 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -163,70 +163,3 @@ jobs: repo: context.repo, prNumber: context.payload.pull_request.number }) - - deploy-docs: - name: 'Prepare Docs for the Review' - runs-on: ubuntu-latest - environment: - name: Docs staging - url: ${{ steps.publish_docs.outputs.preview-url }} - env: - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - steps: - - uses: actions/checkout@v2 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: 8 - - - uses: actions/cache@v2 - name: Download storybook cache - with: - path: | - **/node_modules/.cache - key: ${{ runner.os }}-storybook-${{ github.run_id }} - restore-keys: | - ${{ runner.os }}-storybook - - - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Build Docs - run: pnpm build-docs --quiet - - - name: Deploy docs to Vercel - id: publish_docs - uses: amondnet/vercel-action@v20 - with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - github-token: ${{ secrets.GITHUB_TOKEN }} - vercel-org-id: cube-dev - vercel-project-id: cube-ui-kit - vercel-args: '--prod' - draft: true - build-dir: ./storybook-docs - comment-on-commit: true - - - name: Comment PR - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const setMessage = require('${{ github.workspace }}/scripts/ci/set-message') - - await setMessage({ - header: "## 🏗 Docs are successfully deployed!", - body: ` - 👀 Preview: ${{ steps.publish_docs.outputs.preview-url }} - `, - github, - repo: context.repo, - prNumber: context.payload.pull_request.number - })