Skip to content

Commit c764934

Browse files
committed
fix(ci): normalize manual release version input
Iteration 1: Addresses CI config failure in Release workflow_dispatch - Accept both v-prefixed and plain semver manual version inputs - Normalize manual input to v-prefixed tag before release steps
1 parent 7945a5e commit c764934

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
workflow_dispatch:
2121
inputs:
2222
version:
23-
description: 'Version to release (e.g., v4.0.6)'
23+
description: 'Version to release (e.g., v4.0.6 or 4.0.6)'
2424
required: true
2525
type: string
2626

@@ -48,9 +48,16 @@ jobs:
4848
- name: Validate version format (manual trigger)
4949
if: github.event_name == 'workflow_dispatch'
5050
run: |
51-
VERSION="${{ github.event.inputs.version }}"
51+
VERSION_RAW="${{ github.event.inputs.version }}"
52+
53+
if [[ "$VERSION_RAW" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
54+
VERSION="v$VERSION_RAW"
55+
else
56+
VERSION="$VERSION_RAW"
57+
fi
58+
5259
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
53-
echo "::error::Invalid version format '$VERSION'. Expected format: v1.2.3 or v1.2.3-beta.1"
60+
echo "::error::Invalid version format '$VERSION_RAW'. Expected format: v1.2.3, 1.2.3, or pre-release variants like v1.2.3-beta.1"
5461
exit 1
5562
fi
5663
echo "Version format validated: $VERSION"
@@ -67,7 +74,12 @@ jobs:
6774
id: version
6875
run: |
6976
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
70-
VERSION="${{ github.event.inputs.version }}"
77+
VERSION_RAW="${{ github.event.inputs.version }}"
78+
if [[ "$VERSION_RAW" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
79+
VERSION="v$VERSION_RAW"
80+
else
81+
VERSION="$VERSION_RAW"
82+
fi
7183
else
7284
VERSION="${GITHUB_REF#refs/tags/}"
7385
fi

0 commit comments

Comments
 (0)