From 70abb8dbe648a8cd0cb43f882238aa5bc93f4b1e Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Sun, 9 Jul 2023 21:38:04 +0200 Subject: [PATCH 1/3] Use deploy-to-vercel-action instead of vercel cli --- .github/workflows/deploy.yml | 18 +++++++++--------- .github/workflows/preview.yml | 33 ++++++++------------------------- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6b1b03abd59..4890a336031 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,15 +37,15 @@ jobs: tar -xf iota.tar tar -xf shimmer.tar tar -xf next.tar - # Convert to Vercel project and upload - - name: Install Vercel CLI - run: npm install --global vercel@latest - - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Project Artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} + # Deploy to Vercel + - name: Deploy to Vercel Action + uses: BetaHuhn/deploy-to-vercel-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + PR_LABELS: false # Trigger Algolia crawler - name: Crawl run: | diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index b7a22eb2fa3..90bc4f89f53 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -51,29 +51,12 @@ jobs: tar -xf shimmer.tar tar -xf next.tar # Convert to Vercel project and upload - - name: Install Vercel CLI - run: npm install --global vercel@latest - - name: Pull Vercel Environment Information - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - - name: Build Project Artifacts - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} - - name: Deploy Project Artifacts to Vercel - run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel_output.txt - # Set the deploy URL as an output - - name: Set deploy url - id: deploy_url - run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT - # Create a comment on the pull request with the deployed URL - - name: Comment on pull request - uses: actions/github-script@v6.4.0 + - name: Deploy to Vercel Action + uses: BetaHuhn/deploy-to-vercel-action@v1 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const DEPLOY_URL = '${{ steps.deploy_url.outputs.DEPLOY_URL }}' - const COMMIT_SHA = '${{ github.event.pull_request.head.sha }}' - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `This pull request has been deployed to Vercel.\n\n\nLatest commit: ${COMMIT_SHA}\n\n:white_check_mark: Preview: ${DEPLOY_URL}` - }) + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + PR_LABELS: false + PREBUILT: true From 9c3291be055b93438a7c59e5d7a141136f972bbd Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Mon, 10 Jul 2023 12:00:46 +0200 Subject: [PATCH 2/3] Update .github/workflows/deploy.yml Co-authored-by: Jeroen van den Hout --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4890a336031..8fad8507b72 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -46,6 +46,7 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} PR_LABELS: false + PREBUILT: true # Trigger Algolia crawler - name: Crawl run: | From 770ec60d8883dd64b45d0d9b03ad89737ae251b5 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Mon, 10 Jul 2023 15:02:09 +0200 Subject: [PATCH 3/3] Apply suggestions from code review --- .github/workflows/deploy.yml | 1 + .github/workflows/preview.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8fad8507b72..1c7af82ec54 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -46,6 +46,7 @@ jobs: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} PR_LABELS: false + PRODUCTION: true PREBUILT: true # Trigger Algolia crawler - name: Crawl diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 90bc4f89f53..d0c61ad37a4 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -60,3 +60,5 @@ jobs: VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} PR_LABELS: false PREBUILT: true + PRODUCTION: false + GITHUB_DEPLOYMENT_ENV: Preview