From 5cb57f132848bad44f9a2ec2b76a8328832404be Mon Sep 17 00:00:00 2001 From: devops Date: Sun, 12 Jul 2026 06:47:44 +0000 Subject: [PATCH] Update .gitea/workflows/build.yaml --- .gitea/workflows/build.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 1801475..3873dda 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -12,9 +12,11 @@ jobs: build: runs-on: ubuntu-latest steps: + # 1. Obtenemos el código - name: Checkout del código uses: actions/checkout@v3 + # 2. Nos autenticamos en tu registro local - name: Login en Gitea Registry uses: docker/login-action@v2 with: @@ -22,6 +24,7 @@ jobs: username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} + # 3. Construimos y subimos la imagen (Lógica intacta) - name: Construir y Subir Imagen uses: docker/build-push-action@v4 with: @@ -29,4 +32,21 @@ jobs: push: true tags: | gitea.cruzcloud.net/devops/ecommerce-frontend:${{ github.sha }} - gitea.cruzcloud.net/devops/ecommerce-frontend:latest \ No newline at end of file + gitea.cruzcloud.net/devops/ecommerce-frontend:latest + + # 4. NUEVO: Actualizamos el manifiesto y hacemos push + - name: Actualizar Manifiesto GitOps (CD) + run: | + # A) Configuramos la identidad de Git para el commit automático + git config user.name "Cristian Felipe" + git config user.email "cristiancruz0529@gmail.com" + + # B) Buscamos la línea de la imagen y reemplazamos el tag dinámicamente + sed -i "s|image: gitea.cruzcloud.net/devops/ecommerce-frontend:.*|image: gitea.cruzcloud.net/devops/ecommerce-frontend:${{ github.sha }}|g" workloads/ecommerce/frontend.yaml + + # C) Guardamos los cambios + git add workloads/ecommerce/frontend.yaml + + # D) Hacemos el commit. El flag [skip ci] es obligatorio para evitar un bucle infinito. + git commit -m "chore: update frontend image tag to ${{ github.sha }} [skip ci]" || echo "Sin cambios para hacer commit" + git push \ No newline at end of file