@@ -83,19 +83,34 @@ jobs:
8383 id : beta_version
8484 run : |
8585 # Read current version from setup.py
86- CURRENT_VERSION=$(grep -o '__version__ = "[^"]*"' setup.py | cut -d"" -f2 )
86+ CURRENT_VERSION=$(grep -o '__version__ = "[^"]*"' setup.py | sed 's/__version__ = "\(.*\)"/\1/' )
8787 echo "Current version in files: $CURRENT_VERSION"
8888
8989 # Split version into components
90- IFS='.' read -r MAJOR MINOR PATCH_FULL <<< "$CURRENT_VERSION"
90+ IFS='.' read -r MAJOR MINOR PATCH_FULL <<< "$CURRENT_VERSION" || true
91+
92+ # Validate we got valid version components
93+ if [[ -z "$MAJOR" || -z "$MINOR" || -z "$PATCH_FULL" ]]; then
94+ echo "Error: Could not parse version components from $CURRENT_VERSION"
95+ echo "Using default version 0.0.1b1"
96+ MAJOR=0
97+ MINOR=0
98+ PATCH_FULL=1
99+ fi
91100
92101 # Handle beta suffix if it exists
93102 if [[ $PATCH_FULL == *b* ]]; then
94103 # Extract the numeric part before 'b'
95104 PATCH_NUM=${PATCH_FULL%%b*}
96105 # Extract the beta number and increment it
97106 BETA_NUM=${PATCH_FULL#*b}
98- BETA_NUM=$((BETA_NUM + 1))
107+ # Ensure beta number is a valid integer
108+ if ! [[ $BETA_NUM =~ ^[0-9]+$ ]]; then
109+ echo "Warning: Invalid beta number format. Resetting to beta1."
110+ BETA_NUM=1
111+ else
112+ BETA_NUM=$((BETA_NUM + 1))
113+ fi
99114 else
100115 # If not already a beta, use the patch number and start with beta1
101116 PATCH_NUM=$PATCH_FULL
0 commit comments