Files
Scraperr/scripts/version.sh
2025-06-02 19:08:18 -05:00

19 lines
657 B
Bash
Executable File

#!/bin/bash
# ARGS
VERSION_TYPE=$1 # patch, minor, major
# Get the current version from the Chart.yaml file
current_version=$(grep -oP 'version:\s*\K[0-9]+\.[0-9]+\.[0-9]+' helm/Chart.yaml | tr -d '[:space:]')
# Increment the version number
if [ "$VERSION_TYPE" == "patch" ]; then
new_version=$(echo $current_version | awk -F. -v OFS=. '{$NF++; print}')
elif [ "$VERSION_TYPE" == "minor" ]; then
new_version=$(echo $current_version | awk -F. -v OFS=. '{$2++; $3=0; print}')
elif [ "$VERSION_TYPE" == "major" ]; then
new_version=$(echo $current_version | awk -F. -v OFS=. '{$1++; $2=0; $3=0; print}')
fi
# Output the new version
echo "$new_version"