Skip to content

[Snyk] Security upgrade expo-router from 4.0.9 to 4.0.15 #54

[Snyk] Security upgrade expo-router from 4.0.9 to 4.0.15

[Snyk] Security upgrade expo-router from 4.0.9 to 4.0.15 #54

Workflow file for this run

name: Movil CI/CD Workflow - Main
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions: write-all
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Run ESLint
run: npm run lint || echo "Lint errors encountered, but continuing."
integration-tests:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm install
- name: Check installed packages
run: npm list jest
snyk-scan:
needs: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Snyk CLI
run: npm install -g snyk
deploy:
runs-on: ubuntu-latest
needs: snyk-scan
if: github.ref == 'refs/heads/main' # Solo ejecuta este job en la rama master
steps:
# 1. Checkout del código
- name: Checkout code
uses: actions/checkout@v3
# 2. Instalación de EAS CLI (Expo Application Services)
- name: Install EAS CLI
run: npm install -g eas-cli
# 3. Instalación de dependencias
- name: Install dependencies
run: npm install
# 4. Construcción para Android
- name: Build APK for Android
run: eas build --platform android --profile production --non-interactive
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} # Asegúrate de configurar EXPO_TOKEN en GitHub Secrets.
# 5. Obtener URL del artefacto y subir imagen
- name: Upload image and send data to API
run: |
# Obtener URL del artefacto
RESPONSE=$(eas build:list --limit=1 --status=finished --json --non-interactive)
DOWNLOAD_URL=$(echo "$RESPONSE" | jq -r '.[0].artifacts.buildUrl')
echo "La URL del artefacto obtenida es: $DOWNLOAD_URL"
# Verificar si la imagen existe
if [ ! -f "$IMAGE_PATH" ]; then
echo "La imagen no existe en la ruta especificada: $IMAGE_PATH"
exit 1
fi
# Obtener solo el nombre del archivo desde la ruta completa
IMAGE_NAME=$(basename "$IMAGE_PATH")
echo "El nombre del icono es: $IMAGE_NAME"
# Subir la imagen al servidor PHP
curl -X POST \
-F "imagen=@$IMAGE_PATH" \
"$WEB_SERVICE_URL"
# Enviar datos a la API de Express
curl -X POST "$API_URL" \
-H "Content-Type: application/json" \
-d '{
"url": "'"$DOWNLOAD_URL"'",
"nombre": "'"$PROJECT_NAME"'",
"icono": "'"$IMAGE_NAME"'"
}'
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
IMAGE_PATH: ".github/workflows/cirupied.png" # Cambia esto a la ruta de tu icono
WEB_SERVICE_URL: "https://labarbada.store/subirImagen.php"
API_URL: "https://api-admin-six.vercel.app/api/guardar-datos" # Cambia por la URL de tu API
PROJECT_NAME: "CirupieD" # Cambia este valor por el nombre de tu proyecto
notify-email:
needs: [lint, integration-tests, deploy]
runs-on: ubuntu-latest
steps:
- name: Prepare SHA and Run ID
id: vars
run: |
echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "short_run_id=${GITHUB_RUN_ID::7}" >> $GITHUB_ENV
- name: Send Notification Email
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{ secrets.SMTP_HOST }}
server_port: ${{ secrets.SMTP_PORT }}
username: ${{ secrets.SMTP_USERNAME }}
password: ${{ secrets.SMTP_PASSWORD }}
subject: CI/CD Pipeline Notification - ${{ github.ref_name }}
from: CI/CD Bot <[email protected]>
to: ${{ secrets.EMAIL_TO }}
html_body: |
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Notificación de CI/CD Pipeline</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
}
.container {
max-width: 600px;
margin: 0 auto;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.header {
background-color: #4CAF50;
padding: 20px;
color: white;
text-align: center;
}
.content {
padding: 20px;
color: #333;
}
.content h3 {
color: #4CAF50;
}
.content p {
line-height: 1.5;
margin-bottom: 20px;
}
.button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
text-align: center;
border-radius: 5px;
text-decoration: none;
display: inline-block;
margin-top: 20px;
}
.footer {
text-align: center;
font-size: 12px;
color: #888;
padding: 10px;
border-top: 1px solid #eee;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🚀 Notificación de CI/CD Pipeline</h1>
</div>
<div class="content">
<h3>El pipeline ha finalizado</h3>
<p>El estado del pipeline es: <strong>${{ job.status }}</strong></p>
<p><strong>Rama:</strong> ${{ github.ref_name }}</p>
<p><strong>Commit SHA:</strong> ${{ env.short_sha }}</p>
<p><strong>ID de Ejecución:</strong> ${{ env.short_run_id }}</p>
<a href="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" class="button">Ver resultados del pipeline</a>
</div>
<div class="footer">
<p>Este es un mensaje automatizado de tu bot de CI/CD. No es necesario responder.</p>
</div>
</div>
</body>
</html>