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:
6
.github/scripts/extract-version.sh
vendored
6
.github/scripts/extract-version.sh
vendored
@@ -24,6 +24,9 @@ fi
|
|||||||
# Check if pubspec exists
|
# Check if pubspec exists
|
||||||
if [ ! -f "$PUBSPEC_PATH" ]; then
|
if [ ! -f "$PUBSPEC_PATH" ]; then
|
||||||
echo "❌ Error: pubspec.yaml not found at $PUBSPEC_PATH" >&2
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -38,7 +41,8 @@ fi
|
|||||||
VERSION=$(echo "$VERSION_LINE" | sed 's/version: *//' | tr -d ' ')
|
VERSION=$(echo "$VERSION_LINE" | sed 's/version: *//' | tr -d ' ')
|
||||||
|
|
||||||
# Validate version format (X.Y.Z with optional +build or -suffix)
|
# 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 "❌ 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
|
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
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user