From 6789ad1c103131f7122e4ab8bff979d9192f2534 Mon Sep 17 00:00:00 2001 From: filippoxausa Date: Tue, 11 Feb 2025 15:56:24 +0100 Subject: [PATCH 1/3] Added file for CI/CD github action --- .github/workflows/deploy.yml | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..8d37fed --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,44 @@ +name: OCIO Deploy to Render + +on: + push: + branches: + - main + +jobs: + 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 + + - name: Install backend dependencies + run: | + cd backend + npm install + + - name: Install frontend dependencies + run: | + cd frontend + npm install + + - name: Build frontend + run: | + cd frontend + npm run build + + - name: Deploy frontend to Render + run: curl -X POST "$RENDER_DEPLOY_HOOK_FRONTEND" + env: + RENDER_DEPLOY_HOOK_FRONTEND: ${{ secrets.RENDER_DEPLOY_HOOK_FRONTEND }} + + - name: Deploy backend to Render + run: curl -X POST "$RENDER_DEPLOY_HOOK_BACKEND" + env: + RENDER_DEPLOY_HOOK_BACKEND: ${{ secrets.RENDER_DEPLOY_HOOK_BACKEND }} From 99b285be7c78aa85468296d2e99a9196b9527b45 Mon Sep 17 00:00:00 2001 From: filippoxausa Date: Tue, 11 Feb 2025 15:59:10 +0100 Subject: [PATCH 2/3] Modified deploy.yml --- .github/workflows/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8d37fed..e22895d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,9 @@ on: push: branches: - main + pull_request: + branches: + - main jobs: deploy: From 42311fa34d02c9d54a88585282d1a4ca391a0ed0 Mon Sep 17 00:00:00 2001 From: filippoxausa Date: Tue, 11 Feb 2025 16:08:48 +0100 Subject: [PATCH 3/3] Modified deploy.yml --- .github/workflows/deploy.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e22895d..21f6ced 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: OCIO Deploy to Render +name: Deploy to Render on: push: @@ -9,7 +9,7 @@ on: - main jobs: - deploy: + test-and-deploy: runs-on: ubuntu-latest steps: @@ -19,29 +19,42 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 18 + 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 }}