Skip to content

Commit 4b05de4

Browse files
committed
build.sh: Validation version in Git repo to prevent mismatch
1 parent 3a3777b commit 4b05de4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,21 @@ if [ "${skip_git_checkout}" == 0 ]; then
139139
git clean -fdx
140140
git pull origin ${git_treeish} || /bin/true
141141

142+
# Validate version
143+
correct_version=$(python3 << EOF
144+
import version;
145+
if hasattr(version, "patch"):
146+
git_version = f"{version.major}.{version.minor}.{version.patch}-{version.status}"
147+
else:
148+
git_version = f"{version.major}.{version.minor}-{version.status}"
149+
print(git_version == "${godot_version}")
150+
EOF
151+
)
152+
if [[ "$correct_version" != "True" ]]; then
153+
echo "Version in version.py doesn't match the passed ${godot_version}."
154+
exit 0
155+
fi
156+
142157
git archive --format=tar $git_treeish --prefix=godot-${godot_version}/ | gzip > ../godot.tar.gz
143158
popd
144159
fi

0 commit comments

Comments
 (0)