From 65df35f60c35fef4b8cab0e4e9bf47a78ed2465f Mon Sep 17 00:00:00 2001 From: Sohee Lim Date: Fri, 11 Oct 2024 15:30:51 -0400 Subject: [PATCH] fix: update deploy action --- .github/workflows/check-and-deploy.yml | 70 +++++++++----------------- package.json | 2 +- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/.github/workflows/check-and-deploy.yml b/.github/workflows/check-and-deploy.yml index 50300bba5..631a74e6e 100644 --- a/.github/workflows/check-and-deploy.yml +++ b/.github/workflows/check-and-deploy.yml @@ -34,51 +34,9 @@ jobs: - name: Check Formatting run: yarn prettier --check . - deploy-uniswap-preview: - name: Deploy Uniswap Blog Preview - if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/prod' - needs: check-uniswap-benchmarks - permissions: - contents: write - pull-requests: write - outputs: - preview-url: ${{ steps.vercel.outputs.preview-url }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - # need to update once we get the vercel access - - uses: amondnet/vercel-action@v25 - id: vercel - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - vercel-token: ${{ secrets.VERCEL_TOKEN }} - vercel-org-id: ${{ vars.VERCEL_ORG_ID}} - vercel-project-id: ${{ vars.VERCEL_PROJECT_ID}} - working-directory: ./ - scope: ${{ vars.VERCEL_ORG_ID }} - - deploy-uniswap-staging: - name: Deploy Uniswap Blog Staging - if: github.ref == 'refs/heads/main' - needs: check-uniswap-benchmarks - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: amondnet/vercel-action@v25 - id: vercel - 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}} - working-directory: ./ - scope: ${{ secrets.VERCEL_ORG_ID }} - vercel-args: '--prod' - audit_with_lighthouse: name: Audit with Lighthouse runs-on: ubuntu-latest - needs: [deploy-uniswap-preview] if: github.ref != 'refs/head/main' && github.ref != 'refs/heads/prod' permissions: contents: write @@ -87,14 +45,36 @@ jobs: run: working-directory: ./ steps: - - uses: actions/checkout@v3 + # Step 1: Retrieve the Vercel Preview URL + - name: vercel-preview-url + uses: zentered/vercel-preview-url@v1.1.9 + if: github.event_name != 'pull_request' + id: vercel_preview_url + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + GITHUB_REF: 'main' + GITHUB_REPOSITORY: 'your-repo/your-project' + with: + vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }} + + # Step 2: Wait for the Vercel deployment to be ready + - uses: UnlyEd/github-action-await-vercel@v1 + id: await-vercel + if: github.event_name != 'pull_request' + env: + VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} + with: + deployment-url: ${{ steps.vercel_preview_url.outputs.preview_url }} + timeout: 420 + poll-interval: 15 + - uses: actions/checkout@v3 - name: Audit preview URL with Lighthouse (mobile) id: lighthouse_audit_mobile uses: treosh/lighthouse-ci-action@v9 with: urls: | - ${{ needs.deploy-uniswap-preview.outputs.preview-url }} + ${{ steps.vercel_preview_url.outputs.preview_url }} uploadArtifacts: true temporaryPublicStorage: true @@ -103,7 +83,7 @@ jobs: uses: treosh/lighthouse-ci-action@v9 with: urls: | - ${{ needs.deploy-uniswap-preview.outputs.preview-url }} + ${{ steps.vercel_preview_url.outputs.preview_url }} uploadArtifacts: true temporaryPublicStorage: true configPath: .github/lighthouse/lighthouse-config.json diff --git a/package.json b/package.json index 0586c5a55..7425841e1 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ }, "engines": { "npm": "please-use-yarn", - "node": "18.20.4", + "node": "18", "yarn": ">=1.22" } }