Files
cataRio/.gitea/workflows/build-and-deploy.yml
josedario87 64fdf7ce63
Some checks failed
build-and-deploy / build-and-deploy (push) Failing after 2m16s
Feat: Actualizar homepage con branding RioCata y ajustar configuración
2025-10-17 18:28:49 -06:00

62 lines
2.1 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: build-and-deploy
on:
push:
branches: [ main, master ]
jobs:
build-and-deploy:
runs-on: docker
env:
REG: ${{ vars.REGISTRY_URL }}
REPO_OWNER: ${{ github.repository_owner }}
APP_NAME: ${{ vars.APP_NAME }}
APP_DOMAIN: ${{ vars.APP_DOMAIN }}
NUXT_PUBLIC_APP_URL: ${{ vars.NUXT_PUBLIC_APP_URL }}
POSTGRES_DB: ${{ vars.POSTGRES_DB }}
POSTGRES_USER: ${{ vars.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
steps:
- name: Build, push y deploy completo
run: |
set -e
echo "📦 Clonando repositorio..."
git clone https://${{ github.repository_owner }}:${{ secrets.REGISTRY_PASSWORD }}@${{ vars.REGISTRY_URL }}/${{ github.repository }}.git /tmp/repo
cd /tmp/repo
git checkout ${{ github.sha }}
echo "🔐 Login al registry..."
docker login ${{ vars.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }}
echo "🏗️ Construyendo imagen de Nuxt..."
cd nuxt4
docker build -t $REG/$REPO_OWNER/$APP_NAME:${{ github.sha }} -t $REG/$REPO_OWNER/$APP_NAME:latest .
echo "📤 Subiendo imágenes..."
docker push $REG/$REPO_OWNER/$APP_NAME:${{ github.sha }}
docker push $REG/$REPO_OWNER/$APP_NAME:latest
echo " Información de despliegue:"
echo " App: $APP_NAME"
echo " Domain: $APP_DOMAIN"
echo " Image: $REG/$REPO_OWNER/$APP_NAME:latest"
echo " Networks: principal, traefik-network"
cd /tmp/repo
echo "🔄 Descargando imágenes actualizadas..."
docker compose pull
echo "🧹 Limpiando stack anterior..."
docker compose --project-name $APP_NAME down
echo "🚀 Desplegando stack actualizado..."
docker compose --project-name $APP_NAME up -d --remove-orphans --wait
echo "✅ Despliegue completado exitosamente!"
echo "🧼 Limpiando archivos temporales..."
cd /
rm -rf /tmp/repo