Skip to content

Commit e52500a

Browse files
committed
fix update.sh
1 parent 3732d69 commit e52500a

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

scripts/update.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@ cd /home/vito/vito
77
echo "Pulling changes..."
88
git fetch --all
99

10-
# Parse release type argument
11-
INCLUDE_PRE_RELEASES=""
10+
INCLUDE_PATTERN='^3\.[0-9]+\.[0-9]+$' # stable only
1211

1312
if [[ "$1" == "--alpha" ]]; then
14-
INCLUDE_PRE_RELEASES="alpha|beta|rc"
13+
INCLUDE_PATTERN='^3\.[0-9]+\.[0-9]+(-alpha-[0-9]+|-beta-[0-9]+|-rc-[0-9]+)?$'
1514
elif [[ "$1" == "--beta" ]]; then
16-
INCLUDE_PRE_RELEASES="beta|rc"
15+
INCLUDE_PATTERN='^3\.[0-9]+\.[0-9]+(-beta-[0-9]+|-rc-[0-9]+)?$'
1716
fi
1817

19-
echo "Checking out the latest tag..."
18+
# Filter and sort matching tags
19+
MATCHING_TAGS=$(git tag | grep -E "$INCLUDE_PATTERN" | sort -V)
2020

21-
if [[ -n "$INCLUDE_PRE_RELEASES" ]]; then
22-
NEW_RELEASE=$(git tag -l "3.*" | grep -E "$INCLUDE_PRE_RELEASES|^[0-9]+\.[0-9]+\.[0-9]+$" | sort -Vr | head -n 1)
23-
else
24-
NEW_RELEASE=$(git tag -l "3.*" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -Vr | head -n 1)
25-
fi
21+
# Get the latest tag from the list
22+
NEW_RELEASE=$(echo "$MATCHING_TAGS" | tail -n 1)
2623

2724
if [[ -z "$NEW_RELEASE" ]]; then
2825
echo "❌ No matching tag found."

0 commit comments

Comments
 (0)