SCRIPTS: make publish-release try to launch make-releases-json

Now when publishing a release, if make-releases-json is usable at the same
place, it will be called to regenerate the json index of available versions.

(cherry picked from commit 8e9f915f8f8fff2685da28e6c06e1285a1c6293a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 20c1ab273d65a61c4d15d0b42e1462947b224b1c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/scripts/publish-release b/scripts/publish-release
index 4938049..3cf32d8 100755
--- a/scripts/publish-release
+++ b/scripts/publish-release
@@ -17,6 +17,7 @@
 DEVEL=
 QUIET=
 AUTO=
+ARG0="$0"
 NEW=
 DIR=
 DOC=( )
@@ -178,6 +179,11 @@
 	$CMD_GZIP < "$TARGET_DIR/doc/${i#doc/}" > "$TARGET_DIR/doc/${i#doc/}.gz"
 done
 
+if [ -x "${ARG0%/*}/make-releases-json" ]; then
+        # regenerate versions
+        "${ARG0%/*}/make-releases-json" -o "$TARGET_DIR/src/releases.json" "$TARGET_DIR"
+fi
+
 echo "Done : ls -l ${TARGET_DIR}"
 ( cd "$TARGET_DIR" ;
   ls -l src/CHANGELOG "src${DEVEL}/haproxy-${NEW}".tar.gz{,.md5,.sha256} $(for i in "${DOC[@]}"; do echo "doc/${i#doc/}"{,.gz}; done)