diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index a0570a6..806a784 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -6,45 +6,36 @@ on: - main jobs: - # Solo tenemos un job que lo hace todo. build-and-deploy: runs-on: ubuntu-latest steps: - # =================================================================== - # PASO 1: PREPARACIÓN - # =================================================================== - name: Checkout code uses: actions/checkout@v3 - # =================================================================== - # PASO 2: CONSTRUIR IMÁGENES Y GUARDARLAS COMO FICHEROS - # =================================================================== - name: Build Backend Image and Save as Tar run: | docker run --rm -v ${{ gitea.workspace }}:/workspace gcr.io/kaniko-project/executor:v1.9.0 \ - --context=/workspace \ - --dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \ - --no-push \ - --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest \ + --context=/workspace --dockerfile=/workspace/Backend/GestionIntegral.Api/Dockerfile \ + --no-push --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-backend:latest \ --tarPath=/workspace/backend.tar - name: Build Frontend Image and Save as Tar run: | docker run --rm -v ${{ gitea.workspace }}:/workspace gcr.io/kaniko-project/executor:v1.9.0 \ - --context=/workspace \ - --dockerfile=/workspace/Frontend/Dockerfile \ - --no-push \ - --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest \ + --context=/workspace --dockerfile=/workspace/Frontend/Dockerfile \ + --no-push --destination=${{ gitea.actor }}/${{ toLower(gitea.repository_name) }}-frontend:latest \ --tarPath=/workspace/frontend.tar + + # --- PASO DE DEPURACIÓN --- + - name: Debug - List Workspace Contents + run: | + echo "--- Listing contents of ${{ gitea.workspace }} ---" + ls -lR ${{ gitea.workspace }} - # =================================================================== - # PASO 3: DESPLEGAR (COPIAR FICHEROS, CARGAR IMÁGENES Y LEVANTAR) - # =================================================================== - name: Deploy to Production via SCP and SSH run: | - set -e # Fallar inmediatamente si algo sale mal - + set -e echo "Preparing SSH client..." apt-get update && apt-get install -y openssh-client mkdir -p ~/.ssh @@ -53,7 +44,6 @@ jobs: ssh-keyscan -H ${{ secrets.PROD_SERVER_HOST }} >> ~/.ssh/known_hosts echo "Copying image files to production server..." - # Ahora los ficheros .tar están disponibles en el workspace scp ${{ gitea.workspace }}/backend.tar ${{ gitea.workspace }}/frontend.tar ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }}:/opt/gestion-integral/ echo "Connecting to host to load images and deploy..."