From b4f9dd9ef4113832a41eefd0f7b0a6d158a0d18b Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Wed, 5 Oct 2022 15:25:04 +0200 Subject: [PATCH] Check the semver pattern after setting the value (#3418) --- .github/workflows/deploy-release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 4a12d88d..00a43173 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -45,8 +45,7 @@ jobs: - name: Get current release identifier # shellcheck disable=SC2062 run: | - RELESE_VERSION="$(echo ${{ github.event.release.name }} \ - | grep -E -o "v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")" + RELESE_VERSION="${{ github.event.release.name }}" if [ -z "${RELEASE_VERSION}" ]; then echo "No release version found in environment, using input..." @@ -59,6 +58,11 @@ jobs: exit 1 fi + if ! echo "${RELEASE_VERSION}" | grep -E -o "v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+"; then + echo "Error: RELEASE_VERSION doesn't look like a semantic version: ${RELEASE_VERSION}" + exit 2 + fi + { echo "RELEASE_VERSION=${RELESE_VERSION}" echo "SEMVER_VERSION=${RELEASE_VERSION#v}"