-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: improved readability for rc checking
- Loading branch information
1 parent
59f417d
commit b6e844f
Showing
1 changed file
with
18 additions
and
8 deletions.
There are no files selected for viewing
26 changes: 18 additions & 8 deletions
26
actions/latest-version-obtaining/release-candidate-checking.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |