This commit is contained in:
@@ -6,7 +6,6 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Solo tenemos un job que lo hace todo, remotamente.
|
|
||||||
remote-build-and-deploy:
|
remote-build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -15,7 +14,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -e # Fallar inmediatamente si algo sale mal
|
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..."
|
echo "Preparing SSH client..."
|
||||||
apt-get update && apt-get install -y openssh-client git
|
apt-get update && apt-get install -y openssh-client git
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
@@ -30,9 +29,15 @@ jobs:
|
|||||||
|
|
||||||
# --- PARTE 1: PREPARACIÓN (EN EL HOST) ---
|
# --- PARTE 1: PREPARACIÓN (EN EL HOST) ---
|
||||||
echo "--- (HOST) Preparing temporary workspace ---"
|
echo "--- (HOST) Preparing temporary workspace ---"
|
||||||
REPO_URL="${{ gitea.remotes.origin.url }}"
|
# Usamos variables de shell estándar. El runner las pasa.
|
||||||
COMMIT_SHA="${{ gitea.sha }}"
|
REPO_URL="${GITEA_REMOTE_URL}"
|
||||||
TEMP_DIR="/tmp/gitea-build/${{ gitea.run_id }}"
|
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
|
rm -rf $TEMP_DIR
|
||||||
mkdir -p $TEMP_DIR
|
mkdir -p $TEMP_DIR
|
||||||
@@ -48,7 +53,7 @@ jobs:
|
|||||||
--context=/workspace \
|
--context=/workspace \
|
||||||
--dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \
|
--dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \
|
||||||
--no-push \
|
--no-push \
|
||||||
--destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest \
|
--destination=${REPO_NAME}-backend:latest \
|
||||||
--tarPath=/workspace/backend.tar
|
--tarPath=/workspace/backend.tar
|
||||||
|
|
||||||
# Frontend
|
# Frontend
|
||||||
@@ -56,7 +61,7 @@ jobs:
|
|||||||
--context=/workspace \
|
--context=/workspace \
|
||||||
--dockerfile=/workspace/Frontend/Dockerfile \
|
--dockerfile=/workspace/Frontend/Dockerfile \
|
||||||
--no-push \
|
--no-push \
|
||||||
--destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest \
|
--destination=${REPO_NAME}-frontend:latest \
|
||||||
--tarPath=/workspace/frontend.tar
|
--tarPath=/workspace/frontend.tar
|
||||||
|
|
||||||
# --- PARTE 3: DESPLEGAR (EN EL HOST) ---
|
# --- PARTE 3: DESPLEGAR (EN EL HOST) ---
|
||||||
|
|||||||
Reference in New Issue
Block a user