Skip to content

Commit

Permalink
Merge pull request #12 from UnicornUniversity/jd-api-deploy
Browse files Browse the repository at this point in the history
feat: deploy api to render app
  • Loading branch information
kubadrbohlav authored Mar 4, 2025
2 parents cd13f5b + ece7bf6 commit 0f33965
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/backend-render-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
if: env.backend_changed == 'true'
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
2 changes: 1 addition & 1 deletion .github/workflows/frontend-firebase-hosting.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to Firebase Hosting
name: Deploy Frontend to Firebase Hosting

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Frontend Workflow
name: Frontend PR Workflow

on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.use(express.json());
app.use(cookieParser());

app.get("/", (req, res) => {
res.status(200).send("API for BIOT Team 001 is running.");
res.status(200).send("API for BIOT Team 001 is running...");
});

app.listen(port, () => {
Expand Down

0 comments on commit 0f33965

Please sign in to comment.