From 5d282f08d63455cd09fa8abc605c38cb67c062d9 Mon Sep 17 00:00:00 2001 From: Deepak Pandey Date: Sat, 6 Sep 2025 11:14:32 +0530 Subject: [PATCH] FIX: Replace Vercel action with direct CLI deployment - Replaced amondnet/vercel-action@v25 with direct Vercel CLI usage - Added proper project linking by creating .vercel/project.json - Added Node.js setup and Vercel CLI installation steps - Fixed 'Project not found' error by ensuring proper project linking - Updated both staging and production deployment jobs - More reliable deployment process with better error handling --- .github/workflows/ci-cd.yml | 58 +++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index f8f3290f..f2fa15bf 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -253,13 +253,30 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Deploy to Vercel (Staging) - uses: amondnet/vercel-action@v25 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} - vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - vercel-args: '--prod=false' + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Install Vercel CLI + run: npm install -g vercel@latest + + - 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 + 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 + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - name: Run smoke tests run: | @@ -277,13 +294,30 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Deploy to Vercel (Production) - uses: amondnet/vercel-action@v25 + - name: Setup Node.js + uses: actions/setup-node@v4 with: - vercel-token: ${{ secrets.VERCEL_TOKEN }} - vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} - vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} - vercel-args: '--prod' + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Install Vercel CLI + run: npm install -g vercel@latest + + - 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 + 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 + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - name: Run production health check run: |