diff --git a/build.ps1 b/build.ps1 index 066a8b3..fd6444b 100644 --- a/build.ps1 +++ b/build.ps1 @@ -10,16 +10,10 @@ docker buildx version | Out-Null # Set up Docker Buildx builder docker buildx create --use --name tucan-builder --driver docker-container --bootstrap 2>$null | Out-Null -# Fetch the latest version or initialize if not found -$latestVersion = docker manifest inspect "${imageName}:latest" --verbose 2>$null | Select-String -Pattern "org.opencontainers.image.version" | ForEach-Object { ($_ -split ':')[1].Trim() } +# Fetch the latest version from Git tags +$latestVersion = git describe --tags --abbrev=0 2>$null if (-Not $latestVersion) { $latestVersion = "0.1.0" } -# Increment the version number -$versionParts = $latestVersion -split '\.' -$versionParts[2] = [int]$versionParts[2] + 1 -$newVersion = "$($versionParts[0]).$($versionParts[1]).$($versionParts[2])" -Write-Host "New version: $newVersion" - # Build and push the Docker image -docker buildx build --platform $platforms -t "${imageName}:${newVersion}" -t "${imageName}:latest" --push . +docker buildx build --platform $platforms -t "${imageName}:${latestVersion}" -t "${imageName}:latest" --push . Write-Host "Build and push completed successfully."