Files
cataRio/.gitea/workflows/build-and-deploy.yml
josedario87 1e4d254c0a
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m17s
Fix: Usar actions/checkout@v4 en workflow para resolver error de conectividad con Gitea
2025-10-17 19:32:38 -06:00

53 lines
1.8 KiB
YAML
Raw Permalink 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: Checkout del repositorio
uses: actions/checkout@v4
- name: Build, push y deploy completo
run: |
set -e
echo "🔐 Login al registry..."
docker login ${{ vars.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }}
echo "🏗️ Construyendo imagen de Nuxt..."
docker build -t $REG/$REPO_OWNER/$APP_NAME:${{ github.sha }} -t $REG/$REPO_OWNER/$APP_NAME:latest ./nuxt4
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"
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!"