Skip to content

Commit 71dc065

Browse files
authored
Merge pull request #8968 from paulbalandan/script-check
chore: add checks for RELEASE and VERSION variables
2 parents 24a7673 + bab2391 commit 71dc065

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/scripts/deploy-userguide

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,26 @@
66
SOURCE=$1
77
TARGET=$2
88
RELEASE=$3
9-
VERSION=`echo "$RELEASE" | cut -c 2-`
9+
10+
# Check if RELEASE is empty
11+
if [ -z "$RELEASE" ]; then
12+
echo "Error: \$RELEASE parameter is empty."
13+
exit 1
14+
fi
15+
16+
VERSION=$(echo "$RELEASE" | cut -c 2-)
17+
18+
# Check if VERSION is empty
19+
if [ -z "$VERSION" ]; then
20+
echo "Error: Failed to extract \$VERSION from \$RELEASE parameter '$RELEASE'."
21+
exit 1
22+
fi
23+
24+
# Check if VERSION matches the format X.Y.Z
25+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
26+
echo "Error: VERSION '$VERSION' does not match the expected format X.Y.Z."
27+
exit 1
28+
fi
1029

1130
echo "Preparing for version $3"
1231
echo "Merging files from $1 to $2"

0 commit comments

Comments
 (0)