-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (42 loc) · 1.35 KB
/
deploy.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
name: Deploy to Render
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Check if schema.prisma has changed
id: schema_changed
run: |
git fetch origin main
git diff --exit-code origin/main -- prisma/schema.prisma || echo "schema_changed=true" >> $GITHUB_ENV
- name: Generate Prisma client
if: env.schema_changed == 'true'
run: npx prisma generate
- name: Create and apply Prisma migrations
if: env.schema_changed == 'true'
run: |
npx prisma migrate dev --name auto-migration
npx prisma migrate deploy
- name: Build the application
run: yarn build
- name: Deploy to Render
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
SERVICE_ID: ${{ secrets.RENDER_SERVICE_ID }}
run: |
curl -X POST "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}/deploys" \
-H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data '{"clearCache":false}'