mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-26 16:05:29 -04:00
update version bump logic
This commit is contained in:
parent
28580bad88
commit
a1a6872e3f
1 changed files with 15 additions and 16 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Fail out if any step has an error
|
# Fail out if any step has an error
|
||||||
set -e
|
set -e
|
||||||
|
@ -12,8 +12,11 @@ elif [ "$1" == "minor" ]; then
|
||||||
elif [ "$1" == "major" ]; then
|
elif [ "$1" == "major" ]; then
|
||||||
echo Bumping major version
|
echo Bumping major version
|
||||||
PART=major
|
PART=major
|
||||||
|
elif [ "$1" == "build" ]; then
|
||||||
|
echo Bumping build code
|
||||||
|
PART=build
|
||||||
else
|
else
|
||||||
echo Unsupported part! Specify 'patch', 'minor', or 'major'
|
echo Unsupported part! Specify 'build', 'patch', 'minor', or 'major'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -25,7 +28,6 @@ increment_buildcode() {
|
||||||
local new_buildcode=$((buildcode + 1))
|
local new_buildcode=$((buildcode + 1))
|
||||||
echo "${major_minor_patch}+${new_buildcode}"
|
echo "${major_minor_patch}+${new_buildcode}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the current version from pubspec.yaml
|
# Function to get the current version from pubspec.yaml
|
||||||
get_current_version() {
|
get_current_version() {
|
||||||
awk '/^version: / { print $2 }' pubspec.yaml
|
awk '/^version: / { print $2 }' pubspec.yaml
|
||||||
|
@ -43,25 +45,23 @@ update_version() {
|
||||||
eval "$SED_CMD 's/version: .*/version: ${new_version}/' pubspec.yaml"
|
eval "$SED_CMD 's/version: .*/version: ${new_version}/' pubspec.yaml"
|
||||||
}
|
}
|
||||||
|
|
||||||
# I pray none of this errors! - I think it should popup an error should that happen..
|
|
||||||
|
|
||||||
current_version=$(get_current_version)
|
current_version=$(get_current_version)
|
||||||
|
|
||||||
echo "Current Version: $current_version"
|
echo "Current Version: $current_version"
|
||||||
|
|
||||||
|
if [ "$PART" == "build" ]; then
|
||||||
|
final_version=$(increment_buildcode $current_version)
|
||||||
|
else
|
||||||
# Bump the major, minor, or patch version using bump2version
|
# Bump the major, minor, or patch version using bump2version
|
||||||
bump2version --current-version $current_version $PART
|
bump2version --current-version $current_version $PART
|
||||||
|
|
||||||
# Get the new version after bump2version
|
new_version_base=$(get_current_version)
|
||||||
new_version=$(get_current_version)
|
|
||||||
|
|
||||||
# Preserve the current build code
|
|
||||||
buildcode=${current_version#*+}
|
buildcode=${current_version#*+}
|
||||||
new_version="${new_version%+*}+${buildcode}"
|
intermediate_version="${new_version_base%+*}+${buildcode}"
|
||||||
|
|
||||||
# Increment the build code
|
|
||||||
final_version=$(increment_buildcode $new_version)
|
|
||||||
|
|
||||||
|
final_version=$(increment_buildcode $intermediate_version)
|
||||||
|
fi
|
||||||
# Update pubspec.yaml with the final version
|
# Update pubspec.yaml with the final version
|
||||||
update_version $final_version
|
update_version $final_version
|
||||||
|
|
||||||
|
@ -71,4 +71,3 @@ echo "New Version: $final_version"
|
||||||
#git add pubspec.yaml
|
#git add pubspec.yaml
|
||||||
#git commit -m "Bump version to $final_version"
|
#git commit -m "Bump version to $final_version"
|
||||||
#git tag "v$final_version"
|
#git tag "v$final_version"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue