From cf72bd6192ef811ad971d948a34870b336cf7596 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 14 Jun 2024 16:50:58 +0200 Subject: [PATCH] chore(docs): use vercel ci again because GH secret problem on forks (#8142) # Fallback to Vercel CI Since we cannot share the vercel_token on forks we cannot deploy by vercel CLI. This PR reverts to the last working state by using vercel CI. I will look into a fix with an npm script or a turbo config to ignore builds on folder changes. --- .github/workflows/build.yml | 7 --- .github/workflows/docsusaurus.yml | 100 ------------------------------ docs/vercel.json | 2 +- 3 files changed, 1 insertion(+), 108 deletions(-) delete mode 100644 .github/workflows/docsusaurus.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index faf6181ac3..a8f673c2e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,13 +20,6 @@ permissions: pull-requests: write jobs: - docs: - uses: ./.github/workflows/docsusaurus.yml - secrets: - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - core: uses: ./.github/workflows/core.yml with: diff --git a/.github/workflows/docsusaurus.yml b/.github/workflows/docsusaurus.yml deleted file mode 100644 index 9752b0b670..0000000000 --- a/.github/workflows/docsusaurus.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Docs -on: - workflow_call: - secrets: - VERCEL_TOKEN: - description: 'Vercel API Token' - required: true - VERCEL_ORG_ID: - description: 'Vercel Org/Team ID' - required: true - VERCEL_PROJECT_ID: - description: 'Vercel Project ID' - required: true -jobs: - Deploy: - runs-on: ubuntu-latest - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - steps: - - uses: actions/checkout@v4 - - uses: dorny/paths-filter@v3 - id: filter - with: - filters: | - src: - - 'docs/**' - - 'proto/**' - - '.github/workflows/docsusaurus.yml' - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'yarn' - cache-dependency-path: docs/yarn.lock - - name: Install Vercel CLI - run: yarn global add vercel - - name: Install Dependencies - if: steps.filter.outputs.src == 'true' - run: yarn install --frozen-lockfile - working-directory: ./docs - - uses: actions/cache@v4 - if: steps.filter.outputs.src == 'true' - with: - path: | - ${{ github.workspace }}/docs/.docusaurus - ${{ github.workspace }}/docs/node_modules/.cache - key: | - ${{ runner.os }}-docusaurus-${{ hashFiles('**/package-lock.json', '**/npm-shrinkwrap.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} - restore-keys: | - ${{ runner.os }}-docusaurus-${{ hashFiles('**/package-lock.json', '**/npm-shrinkwrap.json', '**/yarn.lock', '**/pnpm-lock.yaml') }} - ${{ runner.os }}-docusaurus-${{ hashFiles('docs/yarn.lock') }} - - name: Prepare Preview Environment - if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - - name: Perpare Production Environment - if: ${{ github.ref == 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Preview - if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - env: - NODE_OPTIONS: "--max_old_space_size=8192" - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Production - if: ${{ github.ref == 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - env: - NODE_OPTIONS: "--max_old_space_size=8192" - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy Preview - if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - run: | - vercel deploy --prebuilt --archive=tgz --token=${{ secrets.VERCEL_TOKEN }} - echo "deploymentUrl=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT - - name: Deploy Production - if: ${{ github.ref == 'refs/heads/main' && steps.filter.outputs.src == 'true'}} - run: | - vercel deploy --prebuilt --archive=tgz --prod --token=${{ secrets.VERCEL_TOKEN }} - - name: Get Preview URL - if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - id: myRequest - uses: fjogeleit/http-request-action@v1 - with: - url: 'https://api.vercel.com/v6/deployments?teamId=${{ secrets.VERCEL_ORG_ID }}&app=docs' - method: 'GET' - customHeaders: '{"Authorization": "Bearer ${{ secrets.VERCEL_TOKEN }}"}' - - uses: cloudposse/github-action-jq@main - if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - id: current - with: - compact: true - raw-output: true - input: ${{ steps.myRequest.outputs.response }} - script: |- - .deployments[] | select(.meta.githubCommitSha == "${{ github.sha }}") | .url - - uses: mshick/add-pr-comment@v2 - if: ${{ github.ref != 'refs/heads/main' && steps.filter.outputs.src == 'true' }} - with: - message: | - Your build has completed! - - [Preview deployment](https://${{ steps.current.outputs.output }}) diff --git a/docs/vercel.json b/docs/vercel.json index d28b5d23ff..809a72beca 100644 --- a/docs/vercel.json +++ b/docs/vercel.json @@ -1,6 +1,6 @@ { "github": { - "enabled": false + "enabled": true }, "cleanUrls": true, "rewrites": [