-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.14 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
name: Trigger Deploy to Render
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to Render
id: deploy
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
SERVICE_ID: ${{ secrets.RENDER_SERVICE_ID }}
run: |
response=$(curl --write-out "%{http_code}" --silent --output response.json --request POST \
--url "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}/deploys" \
--header "accept: application/json" \
--header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \
--header "content-type: application/json")
echo "HTTP_RESPONSE=$response" >> $GITHUB_ENV
if [[ "$response" -eq 200 ]]; then
echo "Deployment triggered successfully"
else
echo "Deployment failed"
cat response.json
exit 1
fi
- name: Success Step
if: success()
run: echo "Deployment was successful"
- name: Failure Step
if: failure()
run: echo "Deployment failed"