Skip to content

Commit e0cca51

Browse files
committed
fix(ci): extract version number from PR title
The workflow was using the full PR title (e.g., 'Release 3.2.1') as the version string, causing Docker tags and release creation to fail. Now extracts just the version number (X.Y.Z or X.Y.Z-suffix) from the PR title, handling formats like 'Release 3.2.1', 'v3.2.1', or '3.2.1'.
1 parent 418e2b4 commit e0cca51

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,14 @@ jobs:
9898
run: |
9999
if [ '${{ github.event_name }}' == 'pull_request' ]; then
100100
if [ ${{ github.event.pull_request.merged }} == true ]; then
101-
echo "version=${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT
101+
# Extract version from PR title (handles "Release X.Y.Z", "vX.Y.Z", or "X.Y.Z")
102+
PR_TITLE="${{ github.event.pull_request.title }}"
103+
VERSION=$(echo "$PR_TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?' | head -1)
104+
if [ -n "$VERSION" ]; then
105+
echo "version=$VERSION" >> $GITHUB_OUTPUT
106+
else
107+
echo "version=$PR_TITLE" >> $GITHUB_OUTPUT
108+
fi
102109
fi
103110
elif [[ ${{ github.event_name }} == 'push' && (${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'*) ]]; then
104111
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)