$scriptPath = $MyInvocation.MyCommand.Definition $projectRoot = Split-Path (Split-Path $scriptPath -Parent) -Parent Set-Location $projectRoot $versionFile = "VERSION" if (Test-Path $versionFile) { $content = Get-Content $versionFile -Raw $currentVersion = $content -replace "BASE_VERSION=","" $currentVersion = $currentVersion.Trim() } else { $currentVersion = "1.1.0" } Write-Host "Current version: v$currentVersion" $v = $currentVersion -split "\." $major = [int]$v[0] $minor = [int]$v[1] $patch = [int]$v[2] $hasMajor = $false $hasMinor = $false $hasPatch = $false try { $logOutput = git log --oneline -20 2>&1 if ($LASTEXITCODE -eq 0) { Write-Host "Analyzing commits:" foreach ($line in $logOutput) { if ($line) { Write-Host " $line" if ($line -like "*BREAKING CHANGE*") { $hasMajor = $true } elseif ($line -like "* feat:*") { $hasMinor = $true } elseif ($line -like "* fix:*" -or $line -like "* perf:*" -or $line -like "* refactor:*") { $hasPatch = $true } } } } } catch { Write-Host "Git not available, using current version" } Write-Host "Version bump decision:" if ($hasMajor) { $major += 1; $minor = 0; $patch = 0 Write-Host " BREAKING CHANGE - bumping MAJOR" } elseif ($hasMinor) { $minor += 1; $patch = 0 Write-Host " feat - bumping MINOR" } elseif ($hasPatch) { $patch += 1 Write-Host " fix/perf/refactor - bumping PATCH" } else { Write-Host " No changes detected, keeping version" } $newVersion = "$($major).$($minor).$($patch)" "BASE_VERSION=$newVersion" | Out-File $versionFile -Encoding utf8 Write-Host "VERSION file updated to: v$newVersion" Write-Output $newVersion