Check the semver pattern after setting the value (#3418)

This commit is contained in:
Marco Ferrari 2022-10-05 15:25:04 +02:00 committed by GitHub
parent 4b6635f63b
commit b4f9dd9ef4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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}"