-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1322b46
commit 2c1d761
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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}' |