@@ -101,23 +101,13 @@ jobs:
101101 run : |
102102 VERSION="${{ steps.extract.outputs.version }}"
103103
104- # For manual testing, allow pre-release versions (e.g., 0.0.1-test)
105- # For production, only allow strict semver (MAJOR.MINOR.PATCH)
106- if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
107- # Manual dispatch: Allow semver with optional pre-release suffix
108- if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$'; then
109- echo "❌ Error: Invalid version format: $VERSION"
110- echo "Expected format: MAJOR.MINOR.PATCH or MAJOR.MINOR.PATCH-prerelease"
111- echo "Examples: 1.2.3 or 0.0.1-test or 1.0.0-rc.1"
112- exit 1
113- fi
114- else
115- # Tag push: Strict semver only (no pre-release)
116- if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
117- echo "❌ Error: Invalid semantic version format: $VERSION"
118- echo "Expected format: MAJOR.MINOR.PATCH (e.g., 1.2.3)"
119- exit 1
120- fi
104+ # Allow semver with optional pre-release/build metadata
105+ # Valid formats: 1.2.3, 1.2.3-beta.1, 1.2.3+build.123, 1.2.3-rc.1+build.456
106+ if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$'; then
107+ echo "❌ Error: Invalid semantic version format: $VERSION"
108+ echo "Expected format: MAJOR.MINOR.PATCH with optional pre-release and build metadata"
109+ echo "Examples: 1.2.3, 0.1.0-beta.1, 1.0.0-rc.1+build.123"
110+ exit 1
121111 fi
122112
123113 echo "✅ Valid version format: $VERSION"
0 commit comments