Update .gitea/workflows/build.yaml
This commit is contained in:
@@ -12,9 +12,11 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
# 1. Obtenemos el código
|
||||||
- name: Checkout del código
|
- name: Checkout del código
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# 2. Nos autenticamos en tu registro local
|
||||||
- name: Login en Gitea Registry
|
- name: Login en Gitea Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
@@ -22,6 +24,7 @@ jobs:
|
|||||||
username: ${{ secrets.REGISTRY_USER }}
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
# 3. Construimos y subimos la imagen (Lógica intacta)
|
||||||
- name: Construir y Subir Imagen
|
- name: Construir y Subir Imagen
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
@@ -29,4 +32,21 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
gitea.cruzcloud.net/devops/ecommerce-frontend:${{ github.sha }}
|
gitea.cruzcloud.net/devops/ecommerce-frontend:${{ github.sha }}
|
||||||
gitea.cruzcloud.net/devops/ecommerce-frontend:latest
|
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