Validate version android-ci and android-release workflow (#3479)

This commit is contained in:
Bart Louwers
2025-05-16 15:02:31 +02:00
committed by GitHub
parent 30f3231396
commit 2538ac1f31
3 changed files with 30 additions and 2 deletions

23
.github/scripts/validate-version.sh vendored Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
validate_version() {
local version="$1"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-pre.*)?$ ]]; then
echo "::error::Invalid version format in VERSION file. Expected: X.Y.Z or X.Y.Z-pre*"
return 1
fi
return 0
}
version=$(cat VERSION 2>/dev/null)
if [ -z "$version" ]; then
echo "::error::VERSION file not found or empty"
exit 1
fi
if validate_version "$version"; then
echo "Version validation successful: $version"
if [[ -n "${GITHUB_ENV:-}" ]]; then
echo "version=$version" >> "$GITHUB_ENV"
fi
fi