-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (46 loc) · 1.24 KB
/
ci_cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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