From 59453528907826cdcfe71c25e4716f0ced0fa5ca Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 30 Mar 2018 06:13:35 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20insert=20version=20tag=20for=20docker=20?= =?UTF-8?q?only=20if=20it=E2=80=99s=20a=20semver?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/post_checkout | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hooks/post_checkout b/hooks/post_checkout index feff21d1f0..864b1dc28f 100644 --- a/hooks/post_checkout +++ b/hooks/post_checkout @@ -9,6 +9,13 @@ IFS=: read DOCKER_REPO CACHE_TAG <<< $IMAGE_NAME echo "repo=${DOCKER_REPO}" echo "tag=${CACHE_TAG}" +SEMVER_REGEX="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$" + +if ! [[ "$CACHE_TAG" =~ $SEMVER_REGEX ]]; then + echo Not a semver tag - skipping + exit +fi + # Write the tag to package.json>version so that "renovate --version" is correct sed -i.bak "s/0.0.0-semantic-release/${CACHE_TAG}/" package.json -- GitLab