Skip to content

Commit

Permalink
different regex check for stable and beta also RC version is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanket-0510 committed Jan 31, 2024
1 parent 7e2d59e commit ca4ff4b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ jobs:
- name: Validate version format
run: |
validate_version() {
if [[ ! "$1" =~ ^[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*(-rcv[0-9]+)?$ ]]; then
echo "Invalid $2 version format. It should be like 1.0.0 or 1.0.0-rcv0014."
exit 1
fi
local regex_pattern_stable='^[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*$'
local regex_pattern_beta='^[0-9]+\.[1-9][0-9]*\.[1-9][0-9]*$'
if [[ "$1" =~ $regex_pattern_stable && ! "$1" =~ -rcv[0-9]+$ ]]; then
echo "Valid $2 version: $1"
elif [[ "$1" =~ $regex_pattern_beta && ! "$1" =~ -rcv[0-9]+$ ]]; then
echo "Valid $2 version: $1"
else
echo "Invalid $2 version format. For stable, it should be like 1.0.0, and for beta, it can be 0.1.0 or higher. No RC candidates allowed."
exit 1
fi
}
validate_version "${{ inputs.candidate-stable }}" "candidate-stable"
Expand Down

0 comments on commit ca4ff4b

Please sign in to comment.