From 6bafe0541d34c1264b14743f29d06ae5b2ebdea6 Mon Sep 17 00:00:00 2001 From: dmolinari Date: Tue, 17 Jun 2025 13:01:25 -0300 Subject: [PATCH] Retry 1301 --- .gitea/workflows/deploy.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 894b60c..4272183 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -6,7 +6,6 @@ on: - main jobs: - # Solo tenemos un job que lo hace todo, remotamente. remote-build-and-deploy: runs-on: ubuntu-latest @@ -15,7 +14,7 @@ jobs: run: | set -e # Fallar inmediatamente si algo sale mal - # 1. Preparar el cliente SSH dentro del contenedor del job (esto es lo único que hacemos aquí) + # 1. Preparar el cliente SSH (lo único que hacemos en este contenedor) echo "Preparing SSH client..." apt-get update && apt-get install -y openssh-client git mkdir -p ~/.ssh @@ -30,9 +29,15 @@ jobs: # --- PARTE 1: PREPARACIÓN (EN EL HOST) --- echo "--- (HOST) Preparing temporary workspace ---" - REPO_URL="${{ gitea.remotes.origin.url }}" - COMMIT_SHA="${{ gitea.sha }}" - TEMP_DIR="/tmp/gitea-build/${{ gitea.run_id }}" + # Usamos variables de shell estándar. El runner las pasa. + REPO_URL="${GITEA_REMOTE_URL}" + COMMIT_SHA="${GITEA_SHA}" + ACTOR="${GITEA_ACTOR}" + REPO_NAME_RAW="${GITEA_REPOSITORY}" # ej: dmolinari/GestionIntegralWeb + # Convertimos a minúsculas usando shell, no una función del runner + REPO_NAME=$(echo "$REPO_NAME_RAW" | tr '[:upper:]' '[:lower:]') + + TEMP_DIR="/tmp/gitea-build/${GITEA_RUN_ID}" rm -rf $TEMP_DIR mkdir -p $TEMP_DIR @@ -48,7 +53,7 @@ jobs: --context=/workspace \ --dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \ --no-push \ - --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest \ + --destination=${REPO_NAME}-backend:latest \ --tarPath=/workspace/backend.tar # Frontend @@ -56,7 +61,7 @@ jobs: --context=/workspace \ --dockerfile=/workspace/Frontend/Dockerfile \ --no-push \ - --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest \ + --destination=${REPO_NAME}-frontend:latest \ --tarPath=/workspace/frontend.tar # --- PARTE 3: DESPLEGAR (EN EL HOST) ---