Skip to content

Commit

Permalink
Add wait for deployment to finish
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcell Dechant committed May 21, 2024
1 parent c148629 commit cf47e5b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
needs: push-to-docker-hub
environment:
name: Capstone Project # Capstone Project name
url: https://neuefische.de/ # Link to deployment
url: https://fullstack-v15z.onrender.com # Link to deployment
steps:
- name: Trigger Render.com Deployment
id: trigger-deploy
Expand All @@ -95,6 +95,20 @@ jobs:
id=$(echo "$response" | jq -r '.id')
echo "deploy_id=$id" >> $GITHUB_ENV
- name: Use Deployment ID
- name: Wait for Deployment to finish
run: |
echo "Deployment ID: ${{ env.deploy_id }}"
curl=$(curl --request GET \
--url https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}/deploys/${{ env.deploy_id }} \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}')
status=$(echo "$curl" | jq -r '.status')
maxTries=10
while [ "$status" != "live" ] && [ $maxTries -gt 0 ]; do
maxTries=$((maxTries - 1))
sleep 10
curl=$(curl --request GET \
--url https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}/deploys/${{ env.deploy_id }} \
--header 'accept: application/json' \
--header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}')
status=$(echo "$curl" | jq -r '.status')
done

0 comments on commit cf47e5b

Please sign in to comment.