Skip to content

Commit 4018225

Browse files
committed
Fixed version tags.
1 parent ba70745 commit 4018225

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

.github/workflows/cd.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66
inputs:
77
tag:
8-
description: 'Tag to build (e.g., v2.10.0, 2.10.0, v2.10, v2)'
8+
description: 'Tag to build (e.g., v2.10.0, v2.10, v2)'
99
required: true
1010
type: string
1111

@@ -43,28 +43,27 @@ jobs:
4343
TAG=${GITHUB_REF#refs/tags/}
4444
fi
4545
46-
# Remove 'v' prefix if present
46+
# Ensure tag starts with 'v'
47+
if [[ ! $TAG =~ ^v ]]; then
48+
TAG="v${TAG}"
49+
fi
50+
51+
# Remove 'v' prefix for splitting
4752
VERSION=${TAG#v}
4853
4954
# Split version into parts
5055
IFS='.' read -ra PARTS <<< "$VERSION"
5156
52-
# Generate tags based on number of version parts
57+
# Generate tags based on number of version parts (keeping 'v' prefix)
5358
if [ ${#PARTS[@]} -eq 1 ]; then
54-
# Only major version (e.g., v2 or 2)
55-
echo "tag_major=$(echo ${{ matrix.db-type }})-${PARTS[0]}" >> $GITHUB_ENV
56-
echo "TAGS=${{ matrix.db-type }}-${PARTS[0]}" >> $GITHUB_ENV
59+
# Only major version (e.g., v2)
60+
echo "TAGS=${{ matrix.db-type }}-v${PARTS[0]}" >> $GITHUB_ENV
5761
elif [ ${#PARTS[@]} -eq 2 ]; then
58-
# Major.minor version (e.g., v2.10 or 2.10)
59-
echo "tag_major=$(echo ${{ matrix.db-type }})-${PARTS[0]}" >> $GITHUB_ENV
60-
echo "tag_minor=$(echo ${{ matrix.db-type }})-${PARTS[0]}.${PARTS[1]}" >> $GITHUB_ENV
61-
echo "TAGS=${{ matrix.db-type }}-${PARTS[0]}, ${{ matrix.db-type }}-${PARTS[0]}.${PARTS[1]}" >> $GITHUB_ENV
62+
# Major.minor version (e.g., v2.10)
63+
echo "TAGS=${{ matrix.db-type }}-v${PARTS[0]}, ${{ matrix.db-type }}-v${PARTS[0]}.${PARTS[1]}" >> $GITHUB_ENV
6264
else
63-
# Full version (e.g., v2.10.0 or 2.10.0)
64-
echo "tag_major=$(echo ${{ matrix.db-type }})-${PARTS[0]}" >> $GITHUB_ENV
65-
echo "tag_minor=$(echo ${{ matrix.db-type }})-${PARTS[0]}.${PARTS[1]}" >> $GITHUB_ENV
66-
echo "tag_patch=$(echo ${{ matrix.db-type }})-${VERSION}" >> $GITHUB_ENV
67-
echo "TAGS=${{ matrix.db-type }}-${PARTS[0]}, ${{ matrix.db-type }}-${PARTS[0]}.${PARTS[1]}, ${{ matrix.db-type }}-${VERSION}" >> $GITHUB_ENV
65+
# Full version (e.g., v2.10.0)
66+
echo "TAGS=${{ matrix.db-type }}-v${PARTS[0]}, ${{ matrix.db-type }}-v${PARTS[0]}.${PARTS[1]}, ${{ matrix.db-type }}-v${VERSION}" >> $GITHUB_ENV
6867
fi
6968
7069
- uses: mr-smithers-excellent/docker-build-push@v6

0 commit comments

Comments
 (0)