readme toc changed #4
This file contains 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: Backend CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test_backend: | |
runs-on: ubuntu-latest | |
services: | |
mongodb: | |
image: mongo:latest | |
ports: | |
- 27017:27017 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js for Backend | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- name: Install Backend dependencies | |
run: | | |
cd backend | |
npm install | |
- name: Run Backend tests | |
env: | |
MONGO_URI: mongodb://localhost:27017/testdb | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
run: cd backend && npm test | |
deploy_backend: | |
needs: test_backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Deploy to Render | |
env: | |
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }} | |
RENDER_SERVICE_ID: ${{ secrets.RENDER_SERVICE_ID }} | |
run: | | |
curl -X POST \ | |
-H "Authorization: Bearer $RENDER_API_KEY" \ | |
-H "Accept: application/json" \ | |
-H "Content-Type: application/json" \ | |
-d '{}' \ | |
https://api.render.com/v1/services/$RENDER_SERVICE_ID/deploys | |