Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy to Render

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18 # Cambia la versione se necessario

# Installazione dipendenze backend
- name: Install backend dependencies
run: |
cd backend
npm install

# Esegui i test
- name: Run backend tests
run: |
cd backend
npm test

# Se i test passano, installiamo dipendenze frontend
- name: Install frontend dependencies
run: |
cd frontend
npm install

# Build del frontend
- name: Build frontend
run: |
cd frontend
npm run build

# Deploy frontend su Render
- name: Deploy frontend to Render
if: success() # Esegue il deploy solo se i test passano
run: curl -X POST "$RENDER_DEPLOY_HOOK_FRONTEND"
env:
RENDER_DEPLOY_HOOK_FRONTEND: ${{ secrets.RENDER_DEPLOY_HOOK_FRONTEND }}

# Deploy backend su Render
- name: Deploy backend to Render
if: success() # Esegue il deploy solo se i test passano
run: curl -X POST "$RENDER_DEPLOY_HOOK_BACKEND"
env:
RENDER_DEPLOY_HOOK_BACKEND: ${{ secrets.RENDER_DEPLOY_HOOK_BACKEND }}
Loading