#!/bin/bash

# Get current version
CURRENT_VERSION=$(cat VERSION)

# Parse version components
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}

# Increment patch version
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"

# Write new version
echo "$NEW_VERSION" > VERSION

# Copy to version package
cp VERSION pkg/version/VERSION

echo "🔖 Version bumped: $CURRENT_VERSION → $NEW_VERSION"