Skip to content

Merge branch 'dev' of https://github.com/Seminario-Integrador-2024/Ge… #635

Merge branch 'dev' of https://github.com/Seminario-Integrador-2024/Ge…

Merge branch 'dev' of https://github.com/Seminario-Integrador-2024/Ge… #635

Workflow file for this run

name: FrontCI Pipeline
on:
push:
branches:
- '**' # Se ejecuta en todas las ramas
pull_request:
branches:
- main # Es para que se ejecute en main nomas
jobs:
lint:
name: Linter de Código
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setear Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Instalar dependencias
run: npm install
working-directory: ./FrontAdmin
- name: Correr linter de codigo
run: npm run lint
working-directory: ./FrontAdmin
start_deploy_render:
name: Iniciar el despligue en Render
runs-on: ubuntu-latest
needs: lint
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && success() # Solo se ejecuta en la rama main
steps:
- name: Desplegar en Render
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST "https://api.render.com/v1/services/srv-cqr6m5l6l47c739pbda0/deploys" -H "Authorization: Bearer $RENDER_API_KEY")
if [ $response -eq 201 ]; then
echo "Deployment successful"
else
echo "Deployment failed with HTTP status code $response"
exit 1
fi
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
deploy_in_process:
name: Despliegue en proceso
runs-on: ubuntu-latest
needs: start_deploy_render
if: success()
steps:
- name: Despliegue en proceso
run: |
deploy_status="pending"
while [ "$deploy_status" != "live" ]; do
response=$(curl -s -H "Authorization: Bearer $RENDER_API_KEY" "https://api.render.com/v1/services/srv-cqr6m5l6l47c739pbda0/deploys")
echo "Render API response: $response"
deploy_status=$(echo $response | jq -r '.[0].deploy.status')
echo "Current deploy status: $deploy_status"
if [ "$deploy_status" == "failed" ]; then
echo "Deployment failed."
exit 1
fi
sleep 5
done
echo "Deployment completed successfully."
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}