Merge pull request #24 from Disha3031/newbackend #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD for K-folio | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| # Build and Deploy Backend | |
| deploy-backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18.x | |
| - name: Install Backend Dependencies | |
| run: | | |
| cd backend | |
| npm install | |
| - name: Build Backend | |
| run: | | |
| cd backend | |
| npm run build | |
| - 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 }} | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_BACKEND_PROJECT_ID }} | |
| - name: Deploy Backend to Vercel | |
| run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_BACKEND_PROJECT_ID }} | |
| # Build and Deploy Frontend | |
| deploy-frontend: | |
| runs-on: ubuntu-latest | |
| needs: deploy-backend | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18.x | |
| - name: Install Frontend Dependencies | |
| run: | | |
| cd frontend | |
| npm install | |
| - name: Build Frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| - 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 }} | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_FRONTEND_PROJECT_ID }} | |
| - name: Deploy Frontend to Vercel | |
| run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_FRONTEND_PROJECT_ID }} |