Skip to content

Commit

Permalink
refactor: improved readability for rc checking
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsonbrsilva committed May 1, 2024
1 parent 59f417d commit b6e844f
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions actions/latest-version-obtaining/release-candidate-checking.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/bin/bash

regex="([0-9]+)\.([0-9]+)\.([0-9]+)-rc-([0-9]+)"

if [[ $VERSION =~ $regex ]]; then
echo "is_release_candidate=true" >> $GITHUB_OUTPUT
echo "The last version found is release candidate."
else
echo "The last version found is not release candidate."
fi
readonly VERSION

is_release_candidate() {
[[ "${1}" =~ ([0-9]+)\.([0-9]+)\.([0-9]+)-rc-([0-9]+) ]]
}

check() {
if is_release_candidate "${1}"; then
printf "is_release_candidate=true" >> "${GITHUB_OUTPUT}"
printf "The last version found is release candidate.\n"
exit 0
fi

printf "The last version found is not release candidate."
exit 0
}

check "${VERSION}"

0 comments on commit b6e844f

Please sign in to comment.