Skip to content

Commit f6d300a

Browse files
committed
Extract build num too
1 parent 07989bc commit f6d300a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/update-version.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,17 @@ jobs:
2525
LATEST_TAG=$(curl -s https://api.github.com/repos/LinearTapeFileSystem/ltfs/tags | jq -r '.[0].name')
2626
echo "Latest tag from upstream: $LATEST_TAG"
2727
28-
# Extract version numbers (e.g., v.2.4.8.2-10520 -> 2.4.8.2)
29-
VERSION=$(echo "$LATEST_TAG" | sed -E 's/^v\.?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/')
28+
# Extract version numbers and build number (e.g., v.2.4.8.2-10520 -> 2.4.8.2 (10520))
29+
VERSION_NUM=$(echo "$LATEST_TAG" | sed -E 's/^v\.?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/')
30+
BUILD_NUM=$(echo "$LATEST_TAG" | sed -E 's/^v\.?[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+-([0-9]+).*/\1/')
31+
32+
# Combine version with build number
33+
if [ -n "$BUILD_NUM" ] && [ "$BUILD_NUM" != "$LATEST_TAG" ]; then
34+
VERSION="$VERSION_NUM ($BUILD_NUM)"
35+
else
36+
VERSION="$VERSION_NUM"
37+
fi
38+
3039
echo "Extracted version: $VERSION"
3140
3241
# Store in output

0 commit comments

Comments
 (0)