fix(ci): improve version extraction script for GitHub Actions compatibility

- Replace bash [[ ]] regex test with grep -Eq for better portability

- Add debug output showing pwd and directory listing on file not found

- Use explicit regex groups for + and - separately for better compatibility
This commit is contained in:
Achintha Isuru
2026-03-05 14:25:34 -05:00
parent 639aeeb708
commit 920ba40c50

View File

@@ -24,6 +24,9 @@ fi
# Check if pubspec exists
if [ ! -f "$PUBSPEC_PATH" ]; then
echo "❌ Error: pubspec.yaml not found at $PUBSPEC_PATH" >&2
echo "📁 Current directory: $(pwd)" >&2
echo "📂 Directory contents:" >&2
ls -la apps/mobile/apps/ 2>&1 | head -20 >&2
exit 1
fi
@@ -38,7 +41,8 @@ fi
VERSION=$(echo "$VERSION_LINE" | sed 's/version: *//' | tr -d ' ')
# Validate version format (X.Y.Z with optional +build or -suffix)
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][a-zA-Z0-9]+)?$ ]]; then
# Use grep for better portability across different bash versions
if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(\+[a-zA-Z0-9]+|-[a-zA-Z0-9]+)?$'; then
echo "❌ Error: Invalid version format in pubspec.yaml: $VERSION" >&2
echo "Expected format: X.Y.Z, X.Y.Z+build, or X.Y.Z-suffix (e.g., 0.1.0, 0.1.0+12, 0.1.0-m3)" >&2
exit 1