@@ -65,24 +65,49 @@ jobs:
6565 echo "App Version: ${{ github.event.inputs.app_version }}"
6666 echo "Release Type: ${{ github.event.inputs.release_type }}"
6767
68+ # Validate semantic versioning format
6869 if [[ ! "$CHART_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
6970 echo "ERROR: Invalid chart version format. Use semantic versioning (e.g., 0.2.0)"
7071 exit 1
7172 fi
7273
74+ # Check if chart exists
7375 if [ ! -f "charts/$CHART_NAME/Chart.yaml" ]; then
7476 echo "ERROR: Chart not found: charts/$CHART_NAME/Chart.yaml"
7577 exit 1
7678 fi
7779
80+ # Get current version and compare
7881 CURRENT_VERSION=$(yq eval '.version' "charts/$CHART_NAME/Chart.yaml")
7982 echo "Current chart version: $CURRENT_VERSION"
8083 echo "New chart version: $CHART_VERSION"
8184
85+ # Prevent same version release
8286 if [ "$CURRENT_VERSION" = "$CHART_VERSION" ]; then
83- echo "WARNING: New version is the same as current version"
87+ echo "ERROR: New version must be different from current version"
88+ echo "Current version in Chart.yaml: $CURRENT_VERSION"
89+ echo "Requested version: $CHART_VERSION"
90+ echo ""
91+ echo "Please increment the version number before releasing."
92+ exit 1
8493 fi
8594
95+ # Check if version is being incremented (not decremented)
96+ IFS='.' read -ra CURR <<< "$CURRENT_VERSION"
97+ IFS='.' read -ra NEW <<< "$CHART_VERSION"
98+
99+ CURRENT_NUM=$((CURR[0] * 10000 + CURR[1] * 100 + CURR[2]))
100+ NEW_NUM=$((NEW[0] * 10000 + NEW[1] * 100 + NEW[2]))
101+
102+ if [ $NEW_NUM -le $CURRENT_NUM ]; then
103+ echo "ERROR: New version ($CHART_VERSION) must be greater than current version ($CURRENT_VERSION)"
104+ echo ""
105+ echo "Semantic versioning requires incrementing version numbers."
106+ exit 1
107+ fi
108+
109+ echo "Version validation passed"
110+
86111 - name : Update Chart.yaml
87112 run : |
88113 CHART_NAME="${{ github.event.inputs.chart_name }}"
@@ -202,6 +227,7 @@ jobs:
202227 echo ""
203228 echo "Common issues:"
204229 echo " - Invalid version format (must be X.Y.Z)"
230+ echo " - Version not incremented properly"
205231 echo " - Chart validation errors"
206232 echo " - Git configuration issues"
207233 echo " - Missing chart files"
0 commit comments