diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index b933c17..8d3ed17 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -45,11 +45,11 @@ jobs: run: | set -euo pipefail SHA_TAG=$(echo "${{ github.sha }}" | cut -c1-7) - IMAGE_NAME="172.35.0.216:3000/simplifique/vendaweb-portal" MANIFEST_FILE="k8s/overlays/prod/deployment-image-digest-patch.yaml" - sed -i -E "s|^([[:space:]]*image: ${IMAGE_NAME}:).*|\\1${SHA_TAG}|g" "$MANIFEST_FILE" + # Match image line for vendaweb-portal and replace tag (works with any registry hostname) + sed -i -E "s|(image: .*vendaweb-portal:).*|\1${SHA_TAG}|" "$MANIFEST_FILE" if [ -z "${{ secrets.GITEA_TOKEN }}" ]; then echo "Missing secrets.GITEA_TOKEN (needed to push back to repo)" @@ -62,5 +62,9 @@ jobs: git config user.email "actions@simplifiquehc.com.br" git add "$MANIFEST_FILE" - git commit -m "chore: update image tag to $SHA_TAG [skip ci]" - git push origin main + if git diff --staged --quiet; then + echo "Manifest already has image tag $SHA_TAG, nothing to commit" + else + git commit -m "chore: update image tag to $SHA_TAG [skip ci]" + git push origin main + fi diff --git a/k8s/overlays/prod/deployment-image-digest-patch.yaml b/k8s/overlays/prod/deployment-image-digest-patch.yaml index c7438f5..04f0a66 100644 --- a/k8s/overlays/prod/deployment-image-digest-patch.yaml +++ b/k8s/overlays/prod/deployment-image-digest-patch.yaml @@ -7,4 +7,4 @@ spec: spec: containers: - name: portal - image: git.simplifiquehc.com.br/simplifique/vendaweb-portal:d7edd99 + image: 172.35.0.216:3000/simplifique/vendaweb-portal:d7edd99