-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (65 loc) · 2.21 KB
/
FrontCi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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 }}