From c58c3509dc2ce4250d19ffc0eae50496d5fd4373 Mon Sep 17 00:00:00 2001
From: Joao Gilberto Magalhaes <joao@byjg.com.br>
Date: Mon, 3 Jul 2023 21:35:01 -0500
Subject: [PATCH] Fix version in the examples

---
 .github/workflows/build.yml                         | 12 +++++++-----
 docs/swarm.md                                       |  2 +-
 examples/docker/docker-compose-changed-label.yml    |  2 +-
 examples/docker/docker-compose-multi-containers.yml |  2 +-
 examples/docker/docker-compose-portainer.yml        |  2 +-
 examples/docker/docker-compose.yml                  |  2 +-
 examples/static/docker-compose.yml                  |  2 +-
 examples/swarm/easyhaproxy.yml                      |  2 +-
 8 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7bdac48..fb991de 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -138,12 +138,14 @@ jobs:
           if [ "$TAG" = "$CURRENT_VERSION" ]; then
             echo "Skipping update version..."
           else
-            sed -i "s#easy-haproxy:[a-zA-Z0-9\.]*#easy-haproxy:$TAG#g" deploy/docker/docker-compose.yml 
-            sed -i "s#version: \"[a-zA-Z0-9\.]*\"#version: \"$TAG\"#g" deploy/kubernetes/easyhaproxy-*.yml 
-            sed -i "s#easy-haproxy:[a-zA-Z0-9\.]*#easy-haproxy:$TAG#g" deploy/kubernetes/easyhaproxy-*.yml 
+            sed -i "s#easy-haproxy:[a-zA-Z0-9\.-]*#easy-haproxy:$TAG#g" deploy/docker/docker-compose.yml 
+            sed -i "s#version: \"[a-zA-Z0-9\.-]*\"#version: \"$TAG\"#g" deploy/kubernetes/easyhaproxy-*.yml 
+            sed -i "s#easy-haproxy:[a-zA-Z0-9\.-]*#easy-haproxy:$TAG#g" deploy/kubernetes/easyhaproxy-*.yml
 
-            sed -i "s#easy-haproxy/[a-zA-Z0-9\.]*/#easy-haproxy/$TAG/#g" docs/kubernetes.md
-            sed -i "s#appVersion: \"[a-zA-Z0-9\.]*\"#appVersion: \"$TAG\"#g" helm/easyhaproxy/Chart.yaml
+            sed -i "s#easy-haproxy/[a-zA-Z0-9\.-]*/#easy-haproxy/$TAG/#g" docs/kubernetes.md
+            sed -i "s#appVersion: \"[a-zA-Z0-9\.-]*\"#appVersion: \"$TAG\"#g" helm/easyhaproxy/Chart.yaml
+          
+            find examples -type f -name '*.yml' -exec sed -i "s#\(byjg/easy-haproxy:\)[a-zA-Z0-9\.-]*#\1$TAG#g" {} \; -print
 
             VERSION=$(grep "version: " helm/easyhaproxy/Chart.yaml |  sed 's#version: ##g')
             NEW_VERSION=$(echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.)
diff --git a/docs/swarm.md b/docs/swarm.md
index 16fe71c..d8dc749 100644
--- a/docs/swarm.md
+++ b/docs/swarm.md
@@ -25,7 +25,7 @@ version: "3"
 
 services:
   haproxy:
-    image: byjg/easy-haproxy
+    image: byjg/easy-haproxy:4.3.1-rc1
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     deploy:
diff --git a/examples/docker/docker-compose-changed-label.yml b/examples/docker/docker-compose-changed-label.yml
index 9f944b5..360068a 100644
--- a/examples/docker/docker-compose-changed-label.yml
+++ b/examples/docker/docker-compose-changed-label.yml
@@ -8,7 +8,7 @@ version: "3"
 
 services:
   haproxy:
-    image: byjg/easy-haproxy
+    image: byjg/easy-haproxy:4.3.1-rc1
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     environment:
diff --git a/examples/docker/docker-compose-multi-containers.yml b/examples/docker/docker-compose-multi-containers.yml
index 98e44cf..1b7ecc4 100644
--- a/examples/docker/docker-compose-multi-containers.yml
+++ b/examples/docker/docker-compose-multi-containers.yml
@@ -11,7 +11,7 @@ version: "3"
 
 services:
   haproxy:
-    image: byjg/easy-haproxy
+    image: byjg/easy-haproxy:4.3.1-rc1
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     environment:
diff --git a/examples/docker/docker-compose-portainer.yml b/examples/docker/docker-compose-portainer.yml
index 9263b50..50ee54f 100644
--- a/examples/docker/docker-compose-portainer.yml
+++ b/examples/docker/docker-compose-portainer.yml
@@ -8,7 +8,7 @@ version: "3"
 
 services:
   easyhaproxy:
-    image: byjg/easy-haproxy
+    image: byjg/easy-haproxy:4.3.1-rc1
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
       - certs_certbot:/certs/certbot
diff --git a/examples/docker/docker-compose.yml b/examples/docker/docker-compose.yml
index 7587ae8..de69f4a 100644
--- a/examples/docker/docker-compose.yml
+++ b/examples/docker/docker-compose.yml
@@ -19,7 +19,7 @@ version: "3"
 
 services:
   haproxy:
-    image: byjg/easy-haproxy
+    image: byjg/easy-haproxy:4.3.1-rc1
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
       - ./host2.local.pem:/certs/haproxy/host2.local.pem
diff --git a/examples/static/docker-compose.yml b/examples/static/docker-compose.yml
index a69904d..7dbd48d 100644
--- a/examples/static/docker-compose.yml
+++ b/examples/static/docker-compose.yml
@@ -5,7 +5,7 @@ version: "3"
 
 services:
   haproxy:
-    image: byjg/easy-haproxy
+    image: byjg/easy-haproxy:4.3.1-rc1
     volumes:
       - ./conf/:/etc/haproxy/static/
       - ./host1.local.pem:/certs/haproxy/host1.local.pem
diff --git a/examples/swarm/easyhaproxy.yml b/examples/swarm/easyhaproxy.yml
index a925757..01aea85 100644
--- a/examples/swarm/easyhaproxy.yml
+++ b/examples/swarm/easyhaproxy.yml
@@ -7,7 +7,7 @@ version: "3"
 
 services:
   haproxy:
-    image: byjg/easy-haproxy:4.3.1-rc2
+    image: byjg/easy-haproxy:4.3.1-rc1
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
       - ./certs:/certs/haproxy