Merge pull request #13 from UnicornUniversity/jd-fix-deploy-condition #2
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
name: Deploy API to Render application | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "backend/**" | |
jobs: | |
deploy_api: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Deploy API | |
run: | | |
RESPONSE=$(curl --silent --write-out "%{http_code}" --output /dev/null --request POST \ | |
--url https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}/deploys \ | |
--header 'accept: application/json' \ | |
--header 'content-type: application/json' \ | |
--header "authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \ | |
--data '{"clearCache": "clear"}') | |
if [ "$RESPONSE" -eq 201 ]; then | |
echo "Deployment request successful!" | |
else | |
echo "Deployment request failed with status code $RESPONSE" | |
exit 1 | |
fi |