From 4b6635f63b48520ec74bc4e341ee746d96278eec Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Tue, 4 Oct 2022 20:35:11 +0200 Subject: [PATCH] Assign RELEASE_VERSION before using it (#3413) --- .github/workflows/deploy-release.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index ba475f05..4a12d88d 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -45,16 +45,22 @@ jobs: - name: Get current release identifier # shellcheck disable=SC2062 run: | - echo "RELEASE_VERSION=$(echo ${{ github.event.release.name }} \ - | grep -E -o "v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")" \ - >> "${GITHUB_ENV}" + RELESE_VERSION="$(echo ${{ github.event.release.name }} \ + | grep -E -o "v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")" + if [ -z "${RELEASE_VERSION}" ]; then echo "No release version found in environment, using input..." RELEASE_VERSION="${{ github.event.inputs.release_version }}" - echo "RELEASE_VERSION=${RELEASE_VERSION}" \ - >> "${GITHUB_ENV}" fi + + # Check the RELEASE_VERSION again + if [ -z "${RELEASE_VERSION}" ]; then + echo "Error RELEASE_VERSION is empty. Exiting..." + exit 1 + fi + { + echo "RELEASE_VERSION=${RELESE_VERSION}" echo "SEMVER_VERSION=${RELEASE_VERSION#v}" echo "SEMVER_MAJOR_VERSION=${SEMVER_VERSION%%.*}" echo "SEMVER_MAJOR_VERSION_WITH_PREFIX=v${SEMVER_MAJOR_VERSION}"