ci-cd pipeline initiated #1
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 Pipeline | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # Backend dependencies install | |
| - name: Install backend dependencies | |
| working-directory: ./Backend | |
| run: npm install | |
| # Frontend dependencies install | |
| - name: Install frontend dependencies | |
| working-directory: ./Frontend | |
| run: npm install | |
| # Build frontend for production | |
| - name: Build frontend | |
| working-directory: ./Frontend | |
| run: npm run build | |
| # -------------- DEPLOY BACKEND TO RENDER ------------- | |
| - name: Deploy Backend to Render | |
| env: | |
| RENDER_SERVICE_ID: srv-d24i006r433s73fp7fb0 | |
| RENDER_API_KEY: rnd_JdZZULP71MXqFf7se0mwyYpQ831d | |
| run: | | |
| curl -X POST "https://api.render.com/deploy/srv-${RENDER_SERVICE_ID}" \ | |
| -H "Authorization: Bearer ${RENDER_API_KEY}" \ | |
| -H 'Accept: application/json' \ | |
| -H 'Content-Type: application/json' \ | |
| -d '{}' | |
| # -------------- DEPLOY FRONTEND TO VERCEL ------------- | |
| - name: Deploy Frontend to Vercel | |
| uses: amondnet/vercel-action@v20 | |
| with: | |
| vercel-token: F5Ry3bB7Dy4LU4yts35gmrJQ | |
| vercel-org-id: xCUkB9gYrcxK5gA20mNAmOU1 | |
| vercel-project-id: prj_msnmqCuPLrcRq5VhVWHk7gzUp0vV | |
| working-directory: ./Frontend | |
| vercel-args: '--prod' | |
| # optional on-error: fail this job if deploy fails | |
| continue-on-error: false |