Skip to content

Commit

Permalink
feat(version): update bump version script
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarzhou-portainer committed Nov 24, 2023
1 parent 2efa18f commit ef69671
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ Help()
echo
echo "The Portainer Agent version is in the semantic version format:"
echo " X.Y.Z (Major.Minor.Patch)"
echo "A alpha version is indicated by a pre-release tag:"
echo " X.Y.Z-alpha.1 (Major.Minor.Patch-alpha.Revision)"
echo "A beta version is indicated by a pre-release tag:"
echo " X.Y.Z-beta.0 (Major.Minor.Patch-beta.Revision)"
echo
echo "The order of bumping is:"
echo "x.x.x -> x.x+1.0-beta.1 -> x.x+1.0-beta.1 -> x.x+1.0"
echo "(2.19.0 -> 2.19.1 -> 2.20.0-beta.1 -> 2.20.0-beta.2 -> 2.20.0)"
echo "x.x.x -> x.x+1.0-alpha.1 -> x.x+1.0-alpha.2 -> x.x+1.0-beta.1 ->"
echo "x.x+1.0-beta.2 -> x.x+1.0 -> x.x+1.1"
echo "For example, bumping from 2.19.0 to 2.20.0 would be:"
echo "(2.19.0 -> 2.19.1 -> 2.20.0-alpha.1 -> 2.20.0-beta.1 -> 2.20.0)"
echo
echo "The current version is defined in multiple files."
echo "This script will update the version in the following files:"
Expand Down Expand Up @@ -107,10 +111,16 @@ patch=${a[2]}

len=${#a[@]}
if [[ $len > 3 ]]; then
NEW_VERSION="${major}.${minor}.${patch}"
pre_release=${a[3]}

if [[ $pre_release == "alpha"* ]]; then
NEW_VERSION="${major}.${minor}.${patch}-beta.1"
elif [[ $pre_release == "beta"* ]]; then
NEW_VERSION="${major}.${minor}.${patch}"
fi
else
if IsReleaseBranch; then
NEW_VERSION="${major}.${minor}.${patch}-beta.1"
NEW_VERSION="${major}.${minor}.${patch}-alpha.1"
else
minor=$((minor+1))
NEW_VERSION="${major}.${minor}.${patch}"
Expand Down

0 comments on commit ef69671

Please sign in to comment.