From 8f322601bb25b7d50afebb090aab616e7e1953f9 Mon Sep 17 00:00:00 2001 From: Deepak Pandey Date: Sat, 6 Sep 2025 11:24:45 +0530 Subject: [PATCH 1/2] FIX: Use vercel link command to properly link project - Replace manual .vercel/project.json creation with 'vercel link' command - Remove existing .vercel directory before linking to avoid conflicts - Use 'vercel link --project' to specify the exact project ID - Fix 'Could not retrieve Project Settings' error - More reliable project linking process for both staging and production --- .github/workflows/ci-cd.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index f2fa15bf..05ec7c81 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -264,9 +264,10 @@ jobs: - name: Link Vercel Project run: | - # Create .vercel directory and project.json to link the project - mkdir -p .vercel - echo '{"orgId":"${{ secrets.VERCEL_ORG_ID }}","projectId":"${{ secrets.VERCEL_PROJECT_ID }}"}' > .vercel/project.json + # Remove any existing .vercel directory to avoid conflicts + rm -rf .vercel + # Link the project using Vercel CLI + vercel link --token ${{ secrets.VERCEL_TOKEN }} --yes --project ${{ secrets.VERCEL_PROJECT_ID }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} @@ -305,9 +306,10 @@ jobs: - name: Link Vercel Project run: | - # Create .vercel directory and project.json to link the project - mkdir -p .vercel - echo '{"orgId":"${{ secrets.VERCEL_ORG_ID }}","projectId":"${{ secrets.VERCEL_PROJECT_ID }}"}' > .vercel/project.json + # Remove any existing .vercel directory to avoid conflicts + rm -rf .vercel + # Link the project using Vercel CLI + vercel link --token ${{ secrets.VERCEL_TOKEN }} --yes --project ${{ secrets.VERCEL_PROJECT_ID }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} From 8a176b2e97b528bd8b6f9344f6b3312b75fae30c Mon Sep 17 00:00:00 2001 From: Deepak Pandey Date: Sat, 6 Sep 2025 11:26:14 +0530 Subject: [PATCH 2/2] FIX: Simplify Vercel deployment by removing linking step - Remove vercel link command that was causing project settings errors - Use direct deployment with --project flag to specify project ID - Eliminate the need for pre-linking by deploying directly - Clean up .vercel directory before each deployment - Simplified and more reliable deployment process for both staging and production --- .github/workflows/ci-cd.yml | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 05ec7c81..d84dd24a 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -262,19 +262,12 @@ jobs: - name: Install Vercel CLI run: npm install -g vercel@latest - - name: Link Vercel Project + - name: Deploy to Vercel (Staging) run: | # Remove any existing .vercel directory to avoid conflicts rm -rf .vercel - # Link the project using Vercel CLI - vercel link --token ${{ secrets.VERCEL_TOKEN }} --yes --project ${{ secrets.VERCEL_PROJECT_ID }} - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - - name: Deploy to Vercel (Staging) - run: | - vercel --token ${{ secrets.VERCEL_TOKEN }} --yes + # Deploy directly with project ID (no linking required) + vercel --token ${{ secrets.VERCEL_TOKEN }} --yes --project ${{ secrets.VERCEL_PROJECT_ID }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} @@ -304,19 +297,12 @@ jobs: - name: Install Vercel CLI run: npm install -g vercel@latest - - name: Link Vercel Project + - name: Deploy to Vercel (Production) run: | # Remove any existing .vercel directory to avoid conflicts rm -rf .vercel - # Link the project using Vercel CLI - vercel link --token ${{ secrets.VERCEL_TOKEN }} --yes --project ${{ secrets.VERCEL_PROJECT_ID }} - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - - - name: Deploy to Vercel (Production) - run: | - vercel --prod --token ${{ secrets.VERCEL_TOKEN }} --yes + # Deploy directly with project ID (no linking required) + vercel --prod --token ${{ secrets.VERCEL_TOKEN }} --yes --project ${{ secrets.VERCEL_PROJECT_ID }} env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}