Update .gitea/workflows/build.yaml
This commit is contained in:
@@ -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:
|
||||
@@ -30,3 +33,20 @@ jobs:
|
||||
tags: |
|
||||
gitea.cruzcloud.net/devops/ecommerce-frontend:${{ github.sha }}
|
||||
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 "[email protected]"
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user