diff --git a/.github/workflows/snap-release.yaml b/.github/workflows/snap-release.yaml index 2f6f79a0b8..14477897de 100644 --- a/.github/workflows/snap-release.yaml +++ b/.github/workflows/snap-release.yaml @@ -21,8 +21,8 @@ jobs: kata_url="https://github.com/kata-containers/kata-containers" latest_version=$(git ls-remote --tags ${kata_url} | egrep -o "refs.*" | egrep -v "\-alpha|\-rc|{}" | egrep -o "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+" | sort -V -r | head -1) current_version="$(echo ${GITHUB_REF} | cut -d/ -f3)" - # Check if the current tag is the latest tag - if echo -e "$latest_version\n$current_version" | sort -C -V; then + # Check semantic versioning format (x.y.z) and if the current tag is the latest tag + if echo "${current_version}" | grep -q "^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+$" && echo -e "$latest_version\n$current_version" | sort -C -V; then # Current version is the latest version, build it snapcraft -d snap --destructive-mode fi