Files
seguidorDeLotes/.gitea/workflows/build-and-deploy.yml
josedario87 fd9515432a
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 16s
Cambiar dominio a lotes.nucleoriofrio.com y limpiar deploy anterior
- Cambiar APP_NAME de 'seguidor-de-lotes' a 'lotes'
- Cambiar dominio de 'seguidor.interno.com' a 'lotes.nucleoriofrio.com'
- Agregar limpieza del deploy anterior en workflow para recrear volumen PostgreSQL
- Esto permitirá que los scripts de init de la BD se ejecuten correctamente
2025-11-21 18:56:17 -06:00

48 lines
1.6 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 }}
# PostgreSQL
POSTGRES_USER: ${{ vars.POSTGRES_USER || 'seguidor' }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD || 'seguidor_password' }}
POSTGRES_DB: ${{ vars.POSTGRES_DB || 'seguidor_lotes' }}
steps:
- uses: actions/checkout@v3
- name: Build, push and deploy
run: |
# Login to registry
docker login $REG -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }}
# Build and push
echo "🔨 Building image..."
cd nuxt4
docker build -t $REG/$REPO_OWNER/$APP_NAME:${{ github.sha }} -t $REG/$REPO_OWNER/$APP_NAME:latest .
echo "📤 Pushing images..."
docker push $REG/$REPO_OWNER/$APP_NAME:${{ github.sha }}
docker push $REG/$REPO_OWNER/$APP_NAME:latest
# Deploy
cd ..
echo " Deploying $APP_NAME"
echo " Domain: $APP_DOMAIN"
echo " Image: $REG/$REPO_OWNER/$APP_NAME:latest"
# Limpiar despliegue anterior si existe (nombre viejo)
docker compose --project-name seguidor-de-lotes down -v 2>/dev/null || true
docker compose pull
docker compose --project-name $APP_NAME down
docker compose --project-name $APP_NAME up -d --remove-orphans --wait